Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Raasl authored and claudep committed Jul 16, 2024
1 parent 7421dd6 commit cad466a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import string
from unittest import mock
from urllib.parse import parse_qsl, urlparse

Expand Down Expand Up @@ -138,6 +139,17 @@ def test_wrong_device_hash(self):
)
self.assertFalse(validation_result)

def test_cookie_valid_characters(self):
user = mock.Mock()
user.pk = 123
user.password = make_password("xx")
allowed_characters = set(string.ascii_letters + string.digits + "-_:")

cookie_value = get_remember_device_cookie(
user=user, otp_device_id="SomeModel/33"
)
self.assertTrue(all(c in allowed_characters for c in cookie_value))


class PhoneUtilsTests(UserMixin, TestCase):
def test_get_available_phone_methods(self):
Expand Down

0 comments on commit cad466a

Please sign in to comment.