Skip to content

Commit

Permalink
Fix ACL expected response (#511)
Browse files Browse the repository at this point in the history
* Fix ACL expected response

* Update test for verify_token

* black

---------

Co-authored-by: Matt Melquiond <matt.LLVW@gmail.com>
  • Loading branch information
duhow and mattLLVW authored Oct 21, 2023
1 parent 33aaf24 commit 26efd49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit 26efd49

Please sign in to comment.