Exemple #1
0
 def test_if_unknown_user_is_forbidden_access(self, mocker,
                                              master_ar_process, path,
                                              valid_user_header):
     log_messages = {'User not found: `bozydar`': SearchCriteria(1, True)}
     with iam_denies_all_requests(mocker):
         with assert_iam_queried_for_uid(mocker, 'bozydar'):
             assert_endpoint_response(master_ar_process,
                                      path,
                                      401,
                                      headers=valid_user_header,
                                      assert_stderr=log_messages)
    def test_if_known_user_is_permitted_access(
            self, mocker, master_ar_process, path, valid_user_header):

        is_auth_location = path.startswith("/acs/api/v1")
        with assert_iam_queried_for_uid(
                mocker, 'bozydar', expect_two_iam_calls=is_auth_location):
            assert_endpoint_response(
                master_ar_process,
                path,
                200,
                headers=valid_user_header,
                )
Exemple #3
0
    def test_if_known_user_is_permitted_access(
            self, mocker, master_ar_process, path, valid_user_header):

        is_auth_location = path.startswith("/acs/api/v1")
        with assert_iam_queried_for_uid(
                mocker, 'bozydar', expect_two_iam_calls=is_auth_location):
            assert_endpoint_response(
                master_ar_process,
                path,
                200,
                headers=valid_user_header,
                )
Exemple #4
0
 def test_if_unknown_user_is_forbidden_access(
         self, mocker, master_ar_process, path, valid_user_header):
     log_messages = {
         'User not found: `bozydar`':
             SearchCriteria(1, True)}
     with iam_denies_all_requests(mocker):
         with assert_iam_queried_for_uid(mocker, 'bozydar'):
             assert_endpoint_response(
                 master_ar_process,
                 path,
                 401,
                 headers=valid_user_header,
                 assert_stderr=log_messages)