-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a redirect so the old filtered scoreboard URLs don't 500.
Fixes #485
- Loading branch information
Showing
4 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from django import test as django_test | ||
from django import urls | ||
|
||
from replays import game_ids | ||
from replays.views import replay_list | ||
from replays.testing import test_case | ||
|
||
|
||
class GameScoreboardRedirectTestCase(test_case.ReplayTestCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.factory = django_test.RequestFactory() | ||
|
||
def _Get(self, game_id, difficulty, shot_id=None): | ||
kwargs = {"game_id": game_id, "difficulty": difficulty} | ||
if shot_id is not None: | ||
kwargs["shot_id"] = shot_id | ||
url = urls.reverse("Replays/GameScoreboardOldRedirect", kwargs=kwargs) | ||
|
||
request = self.factory.get(url) | ||
return replay_list.game_scoreboard_old_url(request, **kwargs) | ||
|
||
def testRedirectsWithShot(self): | ||
response = self._Get(game_ids.GameIDs.TH07, difficulty=1, shot_id="ReimuA") | ||
self.assertEqual(response.status_code, 302) | ||
self.assertEqual( | ||
response.url, | ||
urls.reverse("Replays/GameScoreboard", args=[game_ids.GameIDs.TH07]), | ||
) | ||
|
||
def testRedirectsWithoutShot(self): | ||
response = self._Get(game_ids.GameIDs.TH07, difficulty=1) | ||
self.assertEqual(response.status_code, 302) | ||
self.assertEqual( | ||
response.url, | ||
urls.reverse("Replays/GameScoreboard", args=[game_ids.GameIDs.TH07]), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
django-rosetta==0.9.9 | ||
flake8==6.1.0 | ||
python-dotenv==1.0.0 | ||
black==23.7.0 | ||
black==23.7.0 |