Asserts that an EauthAuthenticationError is returned when the user authenticates, but is not authorized.
(clear_funcs)
| 784 | |
| 785 | @pytest.mark.slow_test |
| 786 | def 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 |