Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit a7574d4

Browse files
committed
yes
1 parent 40c4f42 commit a7574d4

File tree

1 file changed

+10
-31
lines changed

1 file changed

+10
-31
lines changed

aimmo/tests/test_views.py

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ class TestViews(TestCase):
4141

4242
@classmethod
4343
def setUpTestData(cls):
44-
cls.user: User = User.objects.create_user(
45-
"test", "[email protected]", "password"
46-
)
44+
cls.user: User = User.objects.create_user("test", "[email protected]", "password")
4745
cls.user.is_staff = True
4846
cls.user.save()
4947
cls.user_profile: UserProfile = UserProfile(user=cls.user)
@@ -235,9 +233,7 @@ def test_connection_parameters_api_call_returns_404_for_logged_out_user(self):
235233
self.game.can_play.set([user])
236234
self.game.save()
237235

238-
first_response = client_one.get(
239-
reverse("kurono/connection_parameters", kwargs={"game_id": 1})
240-
)
236+
first_response = client_one.get(reverse("kurono/connection_parameters", kwargs={"game_id": 1}))
241237

242238
assert first_response.status_code == 403
243239

@@ -253,9 +249,7 @@ def test_id_of_connection_parameters_same_as_games_url(self):
253249
connection_parameters_response = client.get(
254250
reverse("kurono/connection_parameters", kwargs={"game_id": 1})
255251
).json()
256-
games_api_response = client.get(
257-
reverse("kurono/game_user_details", kwargs={"id": 1})
258-
)
252+
games_api_response = client.get(reverse("kurono/game_user_details", kwargs={"id": 1}))
259253

260254
current_avatar_id = connection_parameters_response["avatar_id"]
261255
games_api_users = json.loads(games_api_response.content)["users"]
@@ -295,9 +289,7 @@ def test_get_token_after_token_set(self):
295289
)
296290

297291
# Token starts as empty, as long as it is empty, we can make more GET requests
298-
response = client.get(
299-
reverse("kurono/game_token", kwargs={"id": 1}), HTTP_GAME_TOKEN=new_token
300-
)
292+
response = client.get(reverse("kurono/game_token", kwargs={"id": 1}), HTTP_GAME_TOKEN=new_token)
301293
assert response.status_code == status.HTTP_200_OK
302294

303295
def test_patch_token_with_no_token(self):
@@ -372,9 +364,7 @@ def test_delete_game(self):
372364
assert game3.game_class == klass
373365

374366
# test only one active game at a time
375-
assert (
376-
models.Game.objects.filter(game_class=klass, is_archived=False).count() == 1
377-
)
367+
assert models.Game.objects.filter(game_class=klass, is_archived=False).count() == 1
378368

379369
def test_delete_non_existent_game(self):
380370
c = self.login()
@@ -398,10 +388,7 @@ def test_game_serializer_settings(self):
398388

399389
serializer = GameSerializer(self.game)
400390

401-
assert (
402-
json.dumps(self.game.settings_as_dict(), sort_keys=True)
403-
== serializer.data["settings"]
404-
)
391+
assert json.dumps(self.game.settings_as_dict(), sort_keys=True) == serializer.data["settings"]
405392

406393
def test_list_all_games(self):
407394
self.game.main_user = self.user
@@ -492,16 +479,12 @@ def test_update_game_worksheet_updates_avatar_codes(self, mock_game_manager):
492479

493480
def test_delete_games(self):
494481
# Create a new teacher with a game to make sure it's not affected
495-
new_user: User = User.objects.create_user(
496-
"test2", "[email protected]", "password"
497-
)
482+
new_user: User = User.objects.create_user("test2", "[email protected]", "password")
498483
new_user.is_staff = True
499484
new_user.save()
500485
new_user_profile: UserProfile = UserProfile(user=new_user)
501486
new_user_profile.save()
502-
new_teacher: Teacher = Teacher.objects.create(
503-
user=new_user_profile, new_user=new_user
504-
)
487+
new_teacher: Teacher = Teacher.objects.create(user=new_user_profile, new_user=new_user)
505488
new_teacher.save()
506489
new_klass, _, _ = create_class_directly(new_user.email)
507490
new_user.save()
@@ -515,12 +498,8 @@ def test_delete_games(self):
515498
data = {"game_ids": [self.game.id, game2.id, new_game.id]}
516499

517500
# Try to login as a student and delete games - they shouldn't have access
518-
_, student_password, student = create_school_student_directly(
519-
self.klass.access_code
520-
)
521-
client = self.login(
522-
username=student.new_user.username, password=student_password
523-
)
501+
_, student_password, student = create_school_student_directly(self.klass.access_code)
502+
client = self.login(username=student.new_user.username, password=student_password)
524503
response = client.post(reverse("game-delete-games"), data)
525504
assert response.status_code == 403
526505
assert Game.objects.filter(is_archived=False).count() == 3

0 commit comments

Comments
 (0)