Skip to content

Commit

Permalink
Update test_backend.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Anay-Joshi26 authored Feb 17, 2024
1 parent 06c3b36 commit 9cf3973
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def test_sanitise():
for username in valid_usernames:
assert sanitise_gamedata(control_game_mode, username, control_totalscore)[1] == username

invalid_username = "f@ucky!ou"
assert sanitise_gamedata(control_game_mode, invalid_username, control_totalscore)[1] == "fuckyou"
invalid_username = "hello@test"
assert sanitise_gamedata(control_game_mode, invalid_username, control_totalscore)[1] == "hellotest"

# TEST TOTALSORE VALIDITY
valid_totalscores = [0, 2000, 300, 3043]
for score in valid_totalscores:
assert sanitise_gamedata(control_game_mode, control_usern, score)[2] == score

invalid_totalscore = "piss" #string is an invalid total score
invalid_totalscore = "invalid" # string is an invalid total score
assert sanitise_gamedata(control_game_mode, control_usern, invalid_totalscore)[2] == 0

def test_new_leaderboard_entry():
Expand Down

0 comments on commit 9cf3973

Please sign in to comment.