mirror of
https://github.com/wekan/wekan.git
synced 2026-01-01 15:18:49 +01:00
api_changes
This commit is contained in:
parent
04e92edb86
commit
f9dff3fc14
2 changed files with 14 additions and 7 deletions
19
.github/workflows/api-tests.yaml
vendored
19
.github/workflows/api-tests.yaml
vendored
|
|
@ -29,19 +29,24 @@ jobs:
|
|||
docker compose up -d
|
||||
sleep 10
|
||||
|
||||
- name: Wait for API to be ready
|
||||
- name: Wait for API /users/login to be ready
|
||||
run: |
|
||||
echo "Waiting for API at localhost:80..."
|
||||
for i in {1..10}; do
|
||||
if curl -s http://localhost:80 >/dev/null; then
|
||||
echo "API is up!"
|
||||
echo "Checking /users/login endpoint readiness..."
|
||||
for i in {1..15}; do
|
||||
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80/users/login)
|
||||
if [ "$status_code" = "400" ] || [ "$status_code" = "200" ]; then
|
||||
echo "API /users/login responded with status $status_code"
|
||||
exit 0
|
||||
fi
|
||||
echo "Retry $i..."
|
||||
echo "Retry $i: API not ready yet, status $status_code"
|
||||
sleep 3
|
||||
done
|
||||
echo "API did not start in time."
|
||||
echo "API /users/login did not become ready in time."
|
||||
exit 1
|
||||
|
||||
- name: Seed DB with test user
|
||||
run: |
|
||||
docker exec your_api_container_name python3 seed_users.py
|
||||
|
||||
- name: Run pytest
|
||||
run: pytest tests_r/ --maxfail=1 --disable-warnings -v
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ class TestUserLogin(unittest.TestCase):
|
|||
"password": "30fnhk03"
|
||||
}
|
||||
response = requests.post(url, json=payload)
|
||||
print("Status code:", response.status_code)
|
||||
print("Response JSON:", response.json())
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn("token", response.json())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue