Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Split up API tokens #7294

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ietf/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ def test_api_get_session_matherials_no_agenda_meeting_url(self):
r = self.client.get(url)
self.assertEqual(r.status_code, 200)

@override_settings(APP_API_TOKENS={"ietf.api.views.email_aliases": ["valid-token"]})
@override_settings(APP_API_TOKENS={"ietf.api.views.draft_aliases": ["valid-token"]})
@mock.patch("ietf.api.views.DraftAliasGenerator")
def test_draft_aliases(self, mock):
mock.return_value = (("alias1", ("a1", "a2")), ("alias2", ("a3", "a4")))
Expand Down Expand Up @@ -935,7 +935,7 @@ def test_draft_aliases(self, mock):
405,
)

@override_settings(APP_API_TOKENS={"ietf.api.views.email_aliases": ["valid-token"]})
@override_settings(APP_API_TOKENS={"ietf.api.views.group_aliases": ["valid-token"]})
@mock.patch("ietf.api.views.GroupAliasGenerator")
def test_group_aliases(self, mock):
mock.return_value = (("alias1", ("ietf",), ("a1", "a2")), ("alias2", ("ietf", "iab"), ("a3", "a4")))
Expand Down
4 changes: 2 additions & 2 deletions ietf/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def directauth(request):
return HttpResponse(status=405)


@requires_api_token("ietf.api.views.email_aliases")
@requires_api_token
@csrf_exempt
def draft_aliases(request):
if request.method == "GET":
Expand All @@ -471,7 +471,7 @@ def draft_aliases(request):
return HttpResponse(status=405)


@requires_api_token("ietf.api.views.email_aliases")
@requires_api_token
@csrf_exempt
def group_aliases(request):
if request.method == "GET":
Expand Down
Loading