Example #1
0
    def test_git_commit_push(self):
        message = 'sample commit'
        expected_result = {
            'remote': get_remote(),
            'branch': get_branch(),
            'commit': get_current_commit()
        }

        self.assertEqual(git_commit_push(message), expected_result)
Example #2
0
def test_git_commit_push(mock_git_push):
    with mock_git_repo():
        message = 'sample commit'
        expected_result = {
            'remote': get_remote(),
            'branch': get_branch(),
            'commit': get_current_commit()
        }

        assert git_commit_push(message) == expected_result
        mock_git_push.assert_called_with()
Example #3
0
def _perform_git_commit(filename, git_commit, git_message):
    if git_commit and git.is_git():
        reset('git')  # resets git commit info

        git.commit(git_message)
        log('Git repository identified. Performing git commit...')

        git_info = {
            'repository': git.get_remote(),
            'commit': git.get_current_commit(),
            'filename': filename,
            'path': git.get_relative_path(),
            'branch': git.get_branch()
        }
        log_git(git_info, verbose=False)
Example #4
0
 def test_get_branch(self):
     expected_result = "sample_branch"
     self.assertEqual(get_branch(), expected_result)
Example #5
0
 def test_get_branch(self):
     expected_result = "master"
     self.assertEqual(get_branch(), expected_result)
Example #6
0
def test_get_branch():
    with mock_git_repo():
        assert get_branch() == "master"

        os.system('git checkout -b sample_branch')
        assert get_branch() == "sample_branch"