Skip to content

Commit

Permalink
fix errors in user/test_tables.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Dec 23, 2023
1 parent c408428 commit 57acbed
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/apps/user/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,21 @@ def test_long_password_error(self):

def test_no_username_error(self):
with self.assertRaises(ValueError) as manager:
BaseUser.create_user_sync(username=None, password="abc123")
BaseUser.create_user_sync(
username=None, # type: ignore
password="abc123",
)

self.assertEqual(
manager.exception.__str__(), "A username must be provided."
)

def test_no_password_error(self):
with self.assertRaises(ValueError) as manager:
BaseUser.create_user_sync(username="bob", password=None)
BaseUser.create_user_sync(
username="bob",
password=None, # type: ignore
)

self.assertEqual(
manager.exception.__str__(), "A password must be provided."
Expand Down Expand Up @@ -272,12 +278,14 @@ def test_hash_update(self):
BaseUser.login_sync(username=username, password=password)
)

hashed_password = (
user_data = (
BaseUser.select(BaseUser.password)
.where(BaseUser.id == user.id)
.first()
.run_sync()["password"]
.run_sync()
)
assert user_data is not None
hashed_password = user_data["password"]

algorithm, iterations_, salt, hashed = BaseUser.split_stored_password(
hashed_password
Expand Down

0 comments on commit 57acbed

Please # to comment.