MCPcopy
hub / github.com/saltstack/salt / test_wheel_eauth_authorization_error

Function test_wheel_eauth_authorization_error

tests/pytests/unit/test_master.py:786–804  ·  view source on GitHub ↗

Asserts that an EauthAuthenticationError is returned when the user authenticates, but is not authorized.

(clear_funcs)

Source from the content-addressed store, hash-verified

784
785@pytest.mark.slow_test
786def test_wheel_eauth_authorization_error(clear_funcs):
787 """
788 Asserts that an EauthAuthenticationError is returned when the user authenticates, but is
789 not authorized.
790 """
791 clear_load = {"eauth": "foo", "username": "test", "fun": "test.arg"}
792 mock_ret = {
793 "error": {
794 "name": "EauthAuthenticationError",
795 "message": (
796 'Authentication failure of type "eauth" occurred for user test.'
797 ),
798 }
799 }
800 with patch(
801 "salt.auth.LoadAuth.authenticate_eauth", MagicMock(return_value=True)
802 ), patch("salt.auth.LoadAuth.get_auth_list", MagicMock(return_value=[])):
803 ret = clear_funcs.wheel(clear_load)
804 assert ret == mock_ret
805
806
807@pytest.mark.slow_test

Callers

nothing calls this directly

Calls 2

patchFunction · 0.50
wheelMethod · 0.45

Tested by

no test coverage detected