Skip to content

Commit

Permalink
auth user
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcmarrow committed Oct 3, 2023
1 parent 3b2efac commit 0266123
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Empty file.
17 changes: 17 additions & 0 deletions tests/pytests/functional/auth/auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import salt.utils.user
from salt import auth


def test_user_is_sudo():
assert auth.AuthUser("bob").is_sudo() is False
assert auth.AuthUser("sudo_bob").is_sudo() is True


def test_user_is_running_user():
current_user = salt.utils.user.get_user()
assert auth.AuthUser(salt.utils.user.get_user() + "1").is_running_user() is False
assert auth.AuthUser(current_user).is_running_user() is True


def test_user_sudo_name():
assert auth.AuthUser("sudo_bob").sudo_name() == "bob"

0 comments on commit 0266123

Please sign in to comment.