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 ACL expected response #511

Merged
merged 5 commits into from
Oct 21, 2023
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
2 changes: 1 addition & 1 deletion api/views/alcali.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def verify(request):
except User.DoesNotExist:
return HttpResponse("Unauthorized", status=401)
if request.POST.get("password") == user.user_settings.token:
return Response({request.POST.get("username"): None})
return Response([])
return HttpResponse("Unauthorized", status=401)


Expand Down
3 changes: 2 additions & 1 deletion tests/test_views_alcali.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,13 @@ def test_search_job(admin_client, dummy_state, dummy_jid, minion_master, jwt):

@pytest.mark.django_db()
def test_verify_token(admin_client, admin_user, jwt):
"""Salt expects a list of ACL permissions"""
response = admin_client.post(
"/api/token/verify/",
{"username": admin_user.username, "password": admin_user.user_settings.token},
**jwt
)
assert response.json()[admin_user.username] is None
assert isinstance(response.json(), list)

response = admin_client.post(
"/api/token/verify/",
Expand Down
Loading