Skip to content

Commit

Permalink
Implement adjustments for DRF 3.15
Browse files Browse the repository at this point in the history
  • Loading branch information
jchristgit committed Mar 29, 2024
1 parent 2f23cb1 commit 6d09746
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pydis_site/apps/api/tests/test_bumped_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def test_returns_404_for_non_existing_data(self):

response = self.client.get(url)
self.assertEqual(response.status_code, 404)
self.assertEqual(response.json(), {"detail": "Not found."})
self.assertEqual(response.json(), {"detail": "No BumpedThread matches the given query."})
7 changes: 6 additions & 1 deletion pydis_site/apps/api/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ def test_fetch_non_existing(self) -> None:

response = self.client.get(f"{sequence.url()}/42")
self.assertEqual(response.status_code, 404)
self.assertDictEqual(response.json(), {'detail': 'Not found.'})
parsed = response.json()
self.assertIn('detail', parsed)
self.assertIn(parsed['detail'], (
"No Filter matches the given query.",
"No FilterList matches the given query."
))

def test_creation(self) -> None:
for name, sequence in get_test_sequences().items():
Expand Down
2 changes: 1 addition & 1 deletion pydis_site/apps/api/tests/test_infractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def test_returns_400_for_second_active_infraction_of_the_same_type(self):
second_response.json(),
{
'non_field_errors': [
'This user already has an active infraction of this type.'
'The fields user, type must make a unique set.'
]
}
)
Expand Down
4 changes: 2 additions & 2 deletions pydis_site/apps/api/tests/test_nominations.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def test_returns_404_on_get_unknown_nomination(self):
response = self.client.get(url, data={})
self.assertEqual(response.status_code, 404)
self.assertEqual(response.json(), {
"detail": "Not found."
"detail": "No Nomination matches the given query."
})

def test_returns_404_on_patch_unknown_nomination(self):
Expand All @@ -391,7 +391,7 @@ def test_returns_404_on_patch_unknown_nomination(self):
response = self.client.patch(url, data={})
self.assertEqual(response.status_code, 404)
self.assertEqual(response.json(), {
"detail": "Not found."
"detail": "No Nomination matches the given query."
})

def test_returns_405_on_list_put(self):
Expand Down
2 changes: 1 addition & 1 deletion pydis_site/apps/api/tests/test_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,4 @@ def test_role_detail_404_all_methods(self):
for method in ('get', 'put', 'patch', 'delete'):
response = getattr(self.client, method)(url)
self.assertEqual(response.status_code, 404)
self.assertJSONEqual(response.content, '{"detail": "Not found."}')
self.assertJSONEqual(response.content, '{"detail": "No Role matches the given query."}')
3 changes: 2 additions & 1 deletion pydis_site/apps/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
bot_router = DefaultRouter(trailing_slash=False)
bot_router.register(
'filter/filter_lists',
FilterListViewSet
FilterListViewSet,
basename='filter-filter-lists',
)
bot_router.register(
"aoc-account-links",
Expand Down

0 comments on commit 6d09746

Please sign in to comment.