Skip to content

Commit 85b9ff3

Browse files
committed
fix test error
1 parent 238e75f commit 85b9ff3

File tree

3 files changed

+64
-3
lines changed

3 files changed

+64
-3
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ jobs:
2121
- name: Build and test
2222
run: |
2323
docker compose version
24+
# Ensure tests directory exists and is copied to the right place
25+
mkdir -p docker/backend/tests
26+
cp tests/test_api.py docker/backend/tests/
2427
docker compose -f docker-compose.dev.yml build
2528
docker compose -f docker-compose.dev.yml up -d
2629
docker compose -f docker-compose.dev.yml exec -T reproschema-server pip install pytest pytest-asyncio pytest-cov
27-
docker compose -f docker-compose.dev.yml exec -T reproschema-server python -m pytest tests/
30+
docker compose -f docker-compose.dev.yml exec -T reproschema-server python -m pytest /app/tests/
2831
docker compose -f docker-compose.dev.yml down
2932
env:
3033
# Core settings

docker-compose.dev.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
services:
32
reproschema-server:
43
container_name: ${CONTAINER_NAME:-reproschema-server}
@@ -19,7 +18,7 @@ services:
1918
- ${DATA_PATH:-./data}:/data:rw
2019
# Development volumes
2120
- ./docker/backend:/app # For live backend changes
22-
- ./tests:/app/tests:ro # Mount from project root, read-only
21+
- ./docker/backend/tests:/app/tests:ro # Mount from backend directory
2322
environment:
2423
# Core settings
2524
- NODE_ENV=${NODE_ENV:-development} # Default to development

docs/api-testing.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# API Testing Guide
2+
3+
## Overview
4+
This guide explains how to test the ReproSchema backend API endpoints manually.
5+
6+
## Prerequisites
7+
- `curl` command-line tool
8+
- Running ReproSchema server (via `docker compose up`)
9+
- Initial token (found in backend logs)
10+
11+
## Getting Started
12+
13+
1. First, check the backend logs to get the initial token:
14+
15+
16+
2. Get an auth token using the initial token:
17+
18+
19+
20+
3. Use the auth token to submit data:
21+
22+
23+
## API Endpoints
24+
25+
### Health Check
26+
27+
28+
### Get Auth Token
29+
30+
Parameters:
31+
- `token`: Initial token from backend logs
32+
- `project`: Project name (default: "study")
33+
- `expiry_minutes`: Token expiry in minutes (default: 90)
34+
35+
### Submit Data
36+
37+
Headers:
38+
- `Authorization`: Auth token from `/api/token` endpoint
39+
- `Content-Type`: Must be `application/json`
40+
41+
### Get Schema
42+
43+
44+
## Data Storage
45+
Submitted responses are stored in:
46+
47+
48+
## Common Issues
49+
1. "Invalid token" error:
50+
- Make sure you're using the correct initial token from logs
51+
- Initial tokens are regenerated on container restart
52+
53+
2. "Invalid auth token" error:
54+
- Auth tokens expire after 90 minutes
55+
- Get a new auth token using the initial token
56+
- Don't include "Bearer " prefix in Authorization header
57+
58+
## Development Testing
59+
For development mode features:

0 commit comments

Comments
 (0)