Пример #1
0
    def test_get_latest_annotated_commit(self):
        git_log_cmd = 'log --show-notes=test-ref -n {0} --pretty=format:"hash,%H,shorthash,%h,commiter,%an <%ae>,date,%at|__NOTE__|%N"'

        git_executor = MockGitExecutor() \
            .expect_call(git_log_cmd.format(30000), ['', 'key01,value01,key02,value02|__NOTE__|note01', 'ignore me',
                                                   'no,note,here,dude|__NOTE__|', 'key11,value11,key12,value12|__NOTE__|note02'])

        git_utils = GitUtils(git_executor)
        commit = git_utils.latest_annotated_commit_with_details('test-ref')

        self.assertDictEqual({'note': 'note01', 'key01':'value01', 'key02': 'value02'}, commit)