| 315 | |
| 316 | |
| 317 | def 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 | |
| 342 | def test_get_groups(load_auth): |