Skip to content

Commit

Permalink
Import sudo function from correct module
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Nov 30, 2023
1 parent d38ab10 commit 173d417
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions python/nav/web/useradmin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from nav.models.manage import Organization
from nav.models.api import APIToken

from nav.web.auth import sudo
from nav.web.auth.sudo import sudo
from nav.web.useradmin import forms


Expand Down Expand Up @@ -396,7 +396,6 @@ def group_detail(request, group_id=None):
privilege_form = forms.PrivilegeForm()

if request.method == 'POST':

if 'submit_group' in request.POST:
group_form = forms.AccountGroupForm(request.POST, instance=group)

Expand Down
15 changes: 15 additions & 0 deletions tests/integration/web/useradmin_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.urls import reverse


def test_operate_as_this_user_should_not_crash(db, client, admin_account):
url = reverse('useradmin-account_detail', args=(admin_account.pk,))
response = client.post(
url,
follow=True,
data={
"account": admin_account.pk,
"submit_sudo": "Operate+as+this+user",
},
)

assert response.status_code == 200

0 comments on commit 173d417

Please sign in to comment.