def test_does_not_have_commit_changes_must_return_empty_list( self, mock_get_merge_request_changes, mock_get_commit_changes): actual = get_version_changes('https://gitlab.com', 'gitlab_token', 'project_id', 'commit_sha') self.assertEqual(actual, [])
def test_does_not_have_merge_request_changes_must_call_get_commit_changes( self, mock_get_merge_request_changes, mock_get_commit_changes): get_version_changes('https://gitlab.com', 'gitlab_token', 'project_id', 'commit_sha') mock_get_commit_changes.assert_called_once_with( 'https://gitlab.com', 'gitlab_token', 'project_id', 'commit_sha')
def test_has_merge_request_changes_must_not_call_get_commit_changes( self, mock_get_merge_request_changes, mock_get_commit_changes): self.assertFalse( mock_get_commit_changes.called, get_version_changes('https://gitlab.com', 'gitlab_token', 'project_id', 'commit_sha'))
def test_has_merge_request_changes_must_return_merge_request_changes( self, mock_get_merge_request_changes): actual = get_version_changes('https://gitlab.com', 'gitlab_token', 'project_id', 'commit_sha') self.assertEqual(actual, ['changes'])
def test_error_on_commit_request_must_raise_http_error( self, mock_get_merge_request_changes, mock_get_commit_changes): with self.assertRaises(HTTPError): get_version_changes('https://gitlab.com', 'gitlab_token', 'project_id', 'commit_sha')