From 5b303ec9036774589a25e6a464c1d31574052002 Mon Sep 17 00:00:00 2001 From: JohannesSetiawan Date: Thu, 22 Feb 2024 20:03:59 +0700 Subject: [PATCH] [RED] Add test for failed log in. --- authentication/tests.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/authentication/tests.py b/authentication/tests.py index 58729f1..d81b4b4 100644 --- a/authentication/tests.py +++ b/authentication/tests.py @@ -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) \ No newline at end of file + 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!") \ No newline at end of file