def test_gitlab_api_verify_request_when_sha_and_secret_match( m_get_branch_and_sha, app): with app.test_request_context('/', headers={'X-Gitlab-Token': 'mysecretsecret'}): api = GitlabAPI('gitlab.com', 'owner', 'repository') api.verify_request('mysecretsecret')
def test_gitlab_api_verify_request_when_sha_and_secret_dont_match_raises_GitRequestWithInvalidSignature( m_get_branch_and_sha, app): with app.test_request_context('/', headers={'X-Gitlab-Token': 'notmysecret'}): api = GitlabAPI('gitlab.com', 'owner', 'repository') with raises(GitRequestWithInvalidSignature): api.verify_request('mysecretsecret')