MCPcopy Create free account
hub / github.com/saltstack/salt / test_load_name

Function test_load_name

tests/pytests/unit/test_auth.py:317–339  ·  view source on GitHub ↗
(load_auth)

Source from the content-addressed store, hash-verified

315
316
317def test_load_name(load_auth):
318 valid_eauth_load = {
319 "username": "test_user",
320 "show_timeout": False,
321 "test_password": "",
322 "eauth": "pam",
323 }
324
325 # Test a case where the loader auth doesn't have the auth type
326 without_auth_type = dict(valid_eauth_load)
327 without_auth_type.pop("eauth")
328 ret = load_auth.load_name(without_auth_type)
329 assert ret == "", "Did not bail when the auth loader didn't have the auth type."
330
331 # Test a case with valid params
332 with patch(
333 "salt.utils.args.arg_lookup",
334 MagicMock(return_value={"args": ["username", "password"]}),
335 ) as format_call_mock:
336 expected_ret = call("fake_func_str")
337 ret = load_auth.load_name(valid_eauth_load)
338 format_call_mock.assert_has_calls((expected_ret,), any_order=True)
339 assert ret == "test_user"
340
341
342def test_get_groups(load_auth):

Callers

nothing calls this directly

Calls 4

load_nameMethod · 0.80
patchFunction · 0.50
callFunction · 0.50
popMethod · 0.45

Tested by

no test coverage detected