Skip to content

Commit

Permalink
[RED] Add test for failed log in.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesSetiawan committed Feb 22, 2024
1 parent c40d7c5 commit 5b303ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion authentication/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ def setUp(self):
def testLoginSuccessful(self):
data = {'username': 'testuser', 'password': 'test'}
response = self.client.post(LOGIN_LINK, json.dumps(data), content_type='application/json')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.status_code, 200)

def testLoginFailed(self):
data = {'username': 'testuser', 'password': 'testwrongpassword'}
response = self.client.post(LOGIN_LINK, json.dumps(data), content_type='application/json')
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json()['msg'],"Wrong username/password!")

0 comments on commit 5b303ec

Please sign in to comment.