Skip to content

Commit

Permalink
forms: add test for clean_device_id
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Dec 20, 2023
1 parent a6c7530 commit 2c54cf9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ def test_auth_token_form(self):
form = AuthenticationTokenForm(None, None, data={'otp_token': '005428'})
self.assertTrue(form.is_valid())
self.assertEqual(form.cleaned_data['otp_token'], '005428')

def test_auth_token_form_clean_device_id_fail(self):
form = AuthenticationTokenForm(None, None, data={'otp_token': '005428',
'device_id': '123'})
self.assertFalse(form.is_valid())
self.assertEqual(form.errors['device_id'],
['Device id is not valid.'])

0 comments on commit 2c54cf9

Please sign in to comment.