Skip to content

Commit

Permalink
change: raise exception for decode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
beaukinstler committed Dec 31, 2022
1 parent 4d3553b commit a96eb47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion db_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ def verify_auth_token(token):
except InvalidSignatureError:
print("Bad token: {0}".format(InvalidSignatureError.message))
return None
except DecodeError:
except DecodeError as e:
print("Decoding error: {0}".format(DecodeError))
raise e
return None
except Exception as e:
print("Unexpected exection")
Expand Down
5 changes: 3 additions & 2 deletions tests/test_db_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_make_user():
u.username = "tester"
u.password_hash = fixture_string_generate(64)
with raises(Exception) as e_info:
token = {"token":"test"}
token = "this should be a problem"
User.verify_auth_token(token)

seconds_to_allow = 1
Expand Down Expand Up @@ -99,7 +99,8 @@ def test_token_decode_error():
u.username = "tester"
u.password_hash = fixture_string_generate(64)
token = ""
assert None == User.verify_auth_token(token)
with raises(Exception) as e_info:
_ = User.verify_auth_token(token)



0 comments on commit a96eb47

Please sign in to comment.