Skip to content

Commit

Permalink
fix: add lookup_value_regex for taxonomy rest api
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Oct 19, 2023
1 parent 9a63ca6 commit cc8de55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions openedx_tagging/core/tagging/rest_api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class TaxonomyView(ModelViewSet):
"""

lookup_value_regex = r"\d+"
serializer_class = TaxonomySerializer
permission_classes = [TaxonomyObjectPermissions]

Expand Down
7 changes: 7 additions & 0 deletions tests/openedx_tagging/core/tagging/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ def test_detail_taxonomy_404(self) -> None:
response = self.client.get(url)
assert response.status_code == status.HTTP_404_NOT_FOUND

def test_detail_taxonomy_invalud_pk(self) -> None:
url = TAXONOMY_DETAIL_URL.format(pk="invalid")

self.client.force_authenticate(user=self.staff)
response = self.client.get(url)
assert response.status_code == status.HTTP_404_NOT_FOUND

@ddt.data(
(None, status.HTTP_401_UNAUTHORIZED),
("user", status.HTTP_403_FORBIDDEN),
Expand Down

0 comments on commit cc8de55

Please sign in to comment.