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

Import sudo function from correct module #2777

Merged
merged 1 commit into from
Nov 30, 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
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
Loading