Skip to content

Commit

Permalink
improving test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
la3679 committed Apr 11, 2024
1 parent e4ae8a6 commit 8051d3e
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions PCP/server/tests/1_api/test_1_signup_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,5 @@ def test_signup_with_missing_fields(self):
response = self.app.post(self.BASE_URL, json=new_user)
self.assertEqual(response.status_code, 400)

def test_signup_with_invalid_email(self):
new_user = {
"username": "la3679",
"password": "Vishulk1234",
"email": "invalid", # Invalid email
"firstname": "Love",
"lastname": "Ahir"
}
response = self.app.post(self.BASE_URL, json=new_user)
self.assertEqual(response.status_code, 409)

def test_duplicate_signup(self):
new_user = {
"username": "existingUser",
"password": "TestPass123!",
"email": "existing@example.com",
"firstname": "Existing",
"lastname": "User"
}
with patch('src.db.signup.user_signup') as mock_user_signup:
mock_user_signup.return_value = ({"message": "User already exists"}, 409)
response = self.app.post(self.BASE_URL, json=new_user)
self.assertEqual(response.status_code, 409)
self.assertEqual(response.json, {"message": "User already exists"})

# Additional tests can be added here to cover more scenarios

if __name__ == '__main__':
unittest.main()

0 comments on commit 8051d3e

Please sign in to comment.