def test_store_validation_contents_returns_mocked_response_succesful_validation(
            self):
        mocking.add_post_mapping_for(self.mock, 'validation',
                                     'validation_response_succeded')
        mock_rule = 'rule_mocked'
        mock_content = mocked_content_for_validation
        under_test = self.client_without_auth.validation

        response = under_test.business('/$service/$owner/$ref$params').store(
            service='v',
            owner='test',
            content=mock_content,
            ref=mock_rule,
            params={'validation': 'full'})

        assert_that(response.data['message'], 'Validation Succeded')
        assert_that(response.resources, none())
    def test_fetch_token_given_there_is_an_error_fetching_the_token_then_client_error_is_raised(
            self):
        mocking.add_post_mapping_for(self.mock, 'identity',
                                     'error_identity_response')

        with pytest.raises(error.AuthorisationError) as client_error:
            Client("http://mock-registry/services/testmock",
                   grant_client_id="piksel-workflow",
                   grant_client_secret="blablabla",
                   adapters=[("http://", self.mock)])

        assert_that(client_error.value.cause, instance_of(InvalidGrantError))

        assert_that(
            client_error.value.args[0],
            '(invalid_grant) The provided authorization grant (e.g., authorization code, resource owner'
            ' credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI '
            'used in the authorization request, or was issued to another client.'
        )