예제 #1
0
 def test_git_push_succeeds_must_call_git_create_tag_once(
         self, mock_get_current_version, mock_generate_version,
         mock_get_version_changes, mock_generate_changelog, mock_git_commit,
         mock_git_push, mock_git_create_tag):
     publish_version('gitlab_endpoint', 'gitlab_token', 'project_id',
                     'commit_sha', 'branch', 'file')
     mock_git_push.assert_called_once_with('branch')
예제 #2
0
 def test_branch_not_develop_must_call_generate_version_with_patch(
         self, mock_get_current_version, mock_generate_version,
         mock_get_version_changes, mock_generate_changelog, mock_git_commit,
         mock_git_push, mock_git_create_tag):
     publish_version('gitlab_endpoint', 'gitlab_token', 'project_id',
                     'commit_sha', 'branch', 'file')
     mock_generate_version.assert_called_once_with(version='1.2.3',
                                                   version_type='patch')
예제 #3
0
 def test_git_push_fails_must_raise_push_error(
         self, mock_get_current_version, mock_generate_version,
         mock_get_version_changes, mock_generate_changelog, mock_git_commit,
         mock_git_push, mock_git_create_tag):
     mock_git_push.side_effect = PushError
     with self.assertRaises(PushError):
         publish_version('gitlab_endpoint', 'gitlab_token', 'project_id',
                         'commit_sha', 'branch', 'file')
예제 #4
0
 def test_get_version_fails_must_raise_http_error(
         self, mock_get_current_version, mock_generate_version,
         mock_get_version_changes, mock_generate_changelog, mock_git_commit,
         mock_git_push, mock_git_create_tag):
     mock_get_version_changes.side_effect = HTTPError(
         'url', 'cde', 'msg', 'hdrs', 'fp')
     with self.assertRaises(HTTPError):
         publish_version('gitlab_endpoint', 'gitlab_token', 'project_id',
                         'commit_sha', 'branch', 'file')
예제 #5
0
 def test_git_commit_fails_must_not_call_git_create_tag(
         self, mock_get_current_version, mock_generate_version,
         mock_get_version_changes, mock_generate_changelog, mock_git_commit,
         mock_git_push, mock_git_create_tag):
     mock_git_commit.side_effect = CommitError
     with self.assertRaises(CommitError):
         self.assertFalse(
             mock_git_create_tag.called,
             publish_version('gitlab_endpoint', 'gitlab_token',
                             'project_id', 'commit_sha', 'branch', 'file'))