Skip to content

Commit

Permalink
[#523] Fix deleted user login test
Browse files Browse the repository at this point in the history
  • Loading branch information
dedenbangkit committed Jun 28, 2022
1 parent 677371f commit 0ca0090
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions backend/api/v1/v1_users/tests/tests_user_invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,20 +351,19 @@ def test_delete_user(self):
call_command("fake_user_seeder")
call_command("fake_approver_seeder")
u = SystemUser.objects.filter(
user_access__role__in=[UserRoleTypes.approver, UserRoleTypes.user
]).first()
user_access__role__in=[
UserRoleTypes.approver, UserRoleTypes.user],
password__isnull=False).first()
response = self.client.delete('/api/v1/user/{0}'.format(u.id),
content_type='application/json',
**header)
self.assertEqual(response.status_code, 204)
user = SystemUser.objects.get(pk=u.id)
self.assertEqual(user.deleted_at is not None, True)
# test login with deleted user
u = SystemUser.objects.filter(
deleted_at__isnull=False).first()
user_payload = {"email": u.email, "password": "test"}
deleted_user = {"email": user.email, "password": "test"}
response = self.client.post('/api/v1/login',
user_payload,
deleted_user,
content_type='application/json')
self.assertEqual(response.status_code, 401)
self.assertEqual(response.json(), {
Expand Down

0 comments on commit 0ca0090

Please sign in to comment.