From 2c54cf9d22f2c56772eaaeded463e1e270a6ad81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Wed, 20 Dec 2023 16:07:37 +0100 Subject: [PATCH] forms: add test for clean_device_id --- tests/test_forms.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_forms.py b/tests/test_forms.py index f8a690a43..f80f93843 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -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.'])