fixed tests

This commit is contained in:
Kyattsukuro 2025-09-18 11:17:46 +02:00
parent 36fb1af01e
commit 2025d26a5c
2 changed files with 15 additions and 3 deletions

View File

@ -34,3 +34,6 @@ For the backend, install dependencies and run the server:
pip install -r simple_chat_api/requirements.txt
DEV=true python -m simple_chat_api
```
To run tests:
`python -m unittest discover -s simple_chat_api/tests -p "*.py"`

View File

@ -185,10 +185,19 @@ class TestAuthEndpoints(unittest.TestCase):
for user,session in self.userSessions.items():
with self.subTest(user=user):
pyload = {
"new_password": "newadminpass"
"old_password": users[user],
"new_password": "newpass"
}
response = session.post(f"{API_URL}/user/changePassword/", json=pyload)
self.assertEqual(response.status_code, 200, f"Admin failed to change password; {response.text}")
response = session.post(f"{API_URL}/user/changePassword", json=pyload)
self.assertEqual(response.status_code, 200, f"Failed to change password; {response.text}")
pyload = {
"new_password": users[user],
"old_password": "newpass"
}
response = session.post(f"{API_URL}/user/changePassword", json=pyload)
self.assertEqual(response.status_code, 200, f"Failed to change passwords back; {response.text}")
class TestMessage(unittest.TestCase):