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)
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()
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)
def test_get_current_commit(self): expected_result = os.popen('git rev-parse HEAD').read().strip() self.assertEqual(get_current_commit(), expected_result)
def test_get_current_commit(): with mock_git_repo(): expected_result = os.popen('git rev-parse HEAD').read().strip() assert get_current_commit() == expected_result