mirror of
https://github.com/wekan/wekan.git
synced 2026-02-11 18:54:22 +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
|
docker compose up -d
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
- name: Wait for API to be ready
|
- name: Wait for API /users/login to be ready
|
||||||
run: |
|
run: |
|
||||||
echo "Waiting for API at localhost:80..."
|
echo "Checking /users/login endpoint readiness..."
|
||||||
for i in {1..10}; do
|
for i in {1..15}; do
|
||||||
if curl -s http://localhost:80 >/dev/null; then
|
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80/users/login)
|
||||||
echo "API is up!"
|
if [ "$status_code" = "400" ] || [ "$status_code" = "200" ]; then
|
||||||
|
echo "API /users/login responded with status $status_code"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "Retry $i..."
|
echo "Retry $i: API not ready yet, status $status_code"
|
||||||
sleep 3
|
sleep 3
|
||||||
done
|
done
|
||||||
echo "API did not start in time."
|
echo "API /users/login did not become ready in time."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
|
- name: Seed DB with test user
|
||||||
|
run: |
|
||||||
|
docker exec your_api_container_name python3 seed_users.py
|
||||||
|
|
||||||
- name: Run pytest
|
- name: Run pytest
|
||||||
run: pytest tests_r/ --maxfail=1 --disable-warnings -v
|
run: pytest tests_r/ --maxfail=1 --disable-warnings -v
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ class TestUserLogin(unittest.TestCase):
|
||||||
"password": "30fnhk03"
|
"password": "30fnhk03"
|
||||||
}
|
}
|
||||||
response = requests.post(url, json=payload)
|
response = requests.post(url, json=payload)
|
||||||
|
print("Status code:", response.status_code)
|
||||||
|
print("Response JSON:", response.json())
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertIn("token", response.json())
|
self.assertIn("token", response.json())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue