Exemplo n.º 1
0
    def test_parse_commit_desc_output(self):
        cd = os.path.dirname(os.path.realpath(__file__))
        raw = file(
            os.path.join(cd, 'gitshow.sample')).read().splitlines()
        output = indexer.process_commits_desc_output(
            raw, 'file:///gitshow.sample')
        expected = [
            {'ttl': 487,
             'line_modifieds': 10,
             'commit_msg': u'Make playbook and task in topic singular',
             'sha': '1ef6088bb6678b78993672ffdec93c7c99a0405d',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': False,
             'committer_date': 1493425136,
             'author_date': 1493424649,
             'committer_email': 'author.a@test',
             'files_list': [
                 'modules',
                 'modules/openstack_project',
                 'modules/openstack_project/files',
                 'modules/openstack_project/files/puppetmaster',
                 'modules/openstack_project/files/puppetmaster/mqtt.py'],
             u'Change-Id': [
                 u'I3e6240560ad562e8f41f7e314ef7a4b0b1178e32'],
             'author_name': u'Author A',
             'committer_name': u'Author A',
             'author_email': 'author.a@test',
             'author_email_domain': 'test'},
            {'ttl': 0,
             'line_modifieds': 0,
             'commit_msg': u'Merge "Cast the playbook uuid as a string"',
             'sha': '0e58c2fd54a50362138849a20bced510480dac8d',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': True,
             'committer_date': 1493423272,
             'author_date': 1493423272,
             'committer_email': '*****@*****.**',
             'files_list': [],
             'author_name': u'Jenkins',
             'committer_name': u'Gerrit Code Review',
             'author_email': '*****@*****.**',
             'author_email_domain': 'review.openstack.org'},
            {'ttl': 0,
             'line_modifieds': 0,
             'commit_msg': u'Merge "Add subunit gearman worker '
             'mqtt info to firehose docs"',
             'sha': 'fb7d2712a907f8f01b817889e88abaf0dad6a109',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': True,
             'committer_date': 1493413511,
             'author_date': 1493413511,
             'committer_email': '*****@*****.**',
             'files_list': [],
             'author_name': u'Jenkins',
             'committer_name': u'Gerrit Code Review',
             'author_email': '*****@*****.**',
             'author_email_domain': 'review.openstack.org'},
            {'ttl': 1651141,
             'line_modifieds': 64,
             'commit_msg': u'Add firehose schema docs',
             'sha': 'd9fda5b81f6c8d64fda2ca2c08246492e800292f',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': False,
             'committer_date': 1493244209,
             'author_date': 1491593068,
             'committer_email': 'author.b@test',
             u'Change-Id': [u'I2157f702c87f32055ba2fad842a05e31539bc857'],
             'files_list': [
                 'doc',
                 'doc/source',
                 'doc/source/components.rst',
                 'doc/source/firehose.rst',
                 'doc/source/firehose_schema.rst',
                 'doc/source/systems.rst'],
             'author_name': u'Author A',
             'committer_name': u'Author B',
             'author_email': 'author.a@test',
             'author_email_domain': 'test'},
            {'ttl': 0,
             'line_modifieds': 2,
             'commit_msg': u'Fix use of _ that should be - in mqtt-ca_certs',
             'sha': '8cb34d026e9c290b83c52301d82b2011406fc7d8',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': False,
             'committer_date': 1493240029,
             'author_date': 1493240029,
             'committer_email': 'author.c@test',
             u'Change-Id': [u'I4155bdd80523b73fdc69f45d6120e8eec986dda7'],
             'files_list': [
                 'modules',
                 'modules/openstack_project',
                 'modules/openstack_project/templates',
                 'modules/openstack_project/templates/logstash',
                 'modules/openstack_project/templates/logstash/' +
                 'jenkins-subunit-worker.yaml.erb'],
             'author_name': u'Author C',
             'committer_name': u'Author C',
             'author_email': 'author.c@test',
             'author_email_domain': 'test'},
            {'author_date': 1493240029,
             'author_email': u'author.c@test',
             'author_email_domain': u'test',
             'author_name': u'Author C',
             'commit_msg': u'Add type declarations for Windows API calls as '
             'found in jaraco.windows 3.6.1. Fixes #758.',
             'committer_date': 1493240029,
             'committer_email': u'author.c@test',
             'committer_name': u'Author C',
             'files_list': [
                 'paramiko',
                 'paramiko/_winapi.py',
                 'sites',
                 'sites/www',
                 'sites/www/changelog.rst'],
             'line_modifieds': 21,
             'merge_commit': False,
             'repos': ['file:///gitshow.sample'],
             'sha': '88364beba125cc8e6e314885db1c909b3d526340',
             'ttl': 0},
            {'author_date': 1493240029,
             'author_email': u'author.c@test',
             'author_email_domain': u'test',
             'author_name': u'Author C',
             'commit_msg': u'windows linefeed was breaking /usr/bin/env from '
             'executing correctly :/s/',
             'committer_date': 1493240029,
             'committer_email': u'author.c@test',
             'committer_name': u'Author C',
             'line_modifieds': 2,
             'merge_commit': False,
             'files_list': ['SickBeard.py'],
             'repos': ['file:///gitshow.sample'],
             'sha': 'f5d7eb5b623b625062cf0d3d8d552ee0ea9000dd',
             'ttl': 0},
            {'author_date': 1493240029,
             'author_email': u'author.c@test',
             'author_email_domain': u'test',
             'author_name': u'Author C',
             'commit_msg': u'Merge pull request #13155 from '
             'coolljt0725/fix_validate_tag_name',
             'committer_date': 1493240029,
             'committer_email': u'author.c@test',
             'committer_name': u'Author C',
             'line_modifieds': 0,
             'files_list': [],
             'merge_commit': True,
             'repos': ['file:///gitshow.sample'],
             'sha': '8e1cc08e799a83ace198ee7a3c6f9169635e7f46',
             'ttl': 0},
            {'author_date': 1352117713,
             'author_email': u'',
             'author_email_domain': u'',
             'author_name': u'*****@*****.**',
             'commit_msg': '',
             'committer_date': 1352117713,
             'committer_email': u'',
             'committer_name': u'*****@*****.**',
             'files_list': [],
             'line_modifieds': 0,
             'merge_commit': False,
             'repos': ['file:///gitshow.sample'],
             'sha': '1c939e7487986f1ada02f1414f6101b7cd696824',
             'ttl': 0},
            ]

        self.assertListEqual(output, expected)
Exemplo n.º 2
0
    def test_parse_commit_desc_output(self):
        cd = os.path.dirname(os.path.realpath(__file__))
        raw = open(
            os.path.join(cd, 'gitshow.sample')).read().splitlines()
        output = indexer.process_commits_desc_output(
            raw, ['file:///gitshow.sample'])
        expected = [
            {'ttl': 487,
             'line_modifieds': 10,
             'commit_msg': 'Make playbook and task in topic singular',
             'sha': '1ef6088bb6678b78993672ffdec93c7c99a0405d',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': False,
             'committer_date': 1493425136,
             'author_date': 1493424649,
             'committer_email': 'author.a@test',
             'files_list': [
                 'modules',
                 'modules/openstack_project',
                 'modules/openstack_project/files',
                 'modules/openstack_project/files/puppetmaster',
                 'modules/openstack_project/files/puppetmaster/mqtt.py'],
             'author_name': 'Author A',
             'committer_name': 'Author A',
             'author_email': 'author.a@test',
             'author_email_domain': 'test'},
            {'ttl': 0,
             'line_modifieds': 0,
             'commit_msg': 'Merge "Cast the playbook uuid as a string"',
             'sha': '0e58c2fd54a50362138849a20bced510480dac8d',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': True,
             'committer_date': 1493423272,
             'author_date': 1493423272,
             'committer_email': '*****@*****.**',
             'files_list': [],
             'author_name': 'Jenkins',
             'committer_name': 'Gerrit Code Review',
             'author_email': '*****@*****.**',
             'author_email_domain': 'review.openstack.org'},
            {'ttl': 0,
             'line_modifieds': 0,
             'commit_msg': 'Merge "Add subunit gearman worker '
             'mqtt info to firehose docs"',
             'sha': 'fb7d2712a907f8f01b817889e88abaf0dad6a109',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': True,
             'committer_date': 1493413511,
             'author_date': 1493413511,
             'committer_email': '*****@*****.**',
             'files_list': [],
             'author_name': 'Jenkins',
             'committer_name': 'Gerrit Code Review',
             'author_email': '*****@*****.**',
             'author_email_domain': 'review.openstack.org'},
            {'ttl': 1651141,
             'line_modifieds': 64,
             'commit_msg': 'Add firehose schema docs',
             'sha': 'd9fda5b81f6c8d64fda2ca2c08246492e800292f',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': False,
             'committer_date': 1493244209,
             'author_date': 1491593068,
             'committer_email': 'author.b@test',
             'files_list': [
                 'doc',
                 'doc/source',
                 'doc/source/components.rst',
                 'doc/source/firehose.rst',
                 'doc/source/firehose_schema.rst',
                 'doc/source/systems.rst'],
             'author_name': 'Author A',
             'committer_name': 'Author B',
             'author_email': 'author.a@test',
             'author_email_domain': 'test'},
            {'ttl': 0,
             'line_modifieds': 2,
             'commit_msg': 'Fix use of _ that should be - in mqtt-ca_certs',
             'sha': '8cb34d026e9c290b83c52301d82b2011406fc7d8',
             'repos': ['file:///gitshow.sample'],
             'merge_commit': False,
             'committer_date': 1493240029,
             'author_date': 1493240029,
             'committer_email': 'author.c@test',
             'files_list': [
                 'modules',
                 'modules/openstack_project',
                 'modules/openstack_project/templates',
                 'modules/openstack_project/templates/logstash',
                 'modules/openstack_project/templates/logstash/' +
                 'jenkins-subunit-worker.yaml.erb'],
             'author_name': 'Author C',
             'committer_name': 'Author C',
             'author_email': 'author.c@test',
             'author_email_domain': 'test'},
            {'author_date': 1493240029,
             'author_email': 'author.c@test',
             'author_email_domain': 'test',
             'author_name': 'Author C',
             'commit_msg': 'Add type declarations for Windows API calls as '
             'found in jaraco.windows 3.6.1. Fixes #758.',
             'committer_date': 1493240029,
             'committer_email': 'author.c@test',
             'committer_name': 'Author C',
             'files_list': [
                 'paramiko',
                 'paramiko/_winapi.py',
                 'sites',
                 'sites/www',
                 'sites/www/changelog.rst'],
             'line_modifieds': 21,
             'merge_commit': False,
             'repos': ['file:///gitshow.sample'],
             'sha': '88364beba125cc8e6e314885db1c909b3d526340',
             'ttl': 0},
            {'author_date': 1493240029,
             'author_email': 'author.c@test',
             'author_email_domain': 'test',
             'author_name': 'Author C',
             'commit_msg': 'windows linefeed was breaking /usr/bin/env from '
             'executing correctly :/s/',
             'committer_date': 1493240029,
             'committer_email': 'author.c@test',
             'committer_name': 'Author C',
             'line_modifieds': 2,
             'merge_commit': False,
             'files_list': ['SickBeard.py'],
             'repos': ['file:///gitshow.sample'],
             'sha': 'f5d7eb5b623b625062cf0d3d8d552ee0ea9000dd',
             'ttl': 0},
            {'author_date': 1493240029,
             'author_email': 'author.c@test',
             'author_email_domain': 'test',
             'author_name': 'Author C',
             'commit_msg': 'Merge pull request #13155 from '
             'coolljt0725/fix_validate_tag_name',
             'committer_date': 1493240029,
             'committer_email': 'author.c@test',
             'committer_name': 'Author C',
             'line_modifieds': 0,
             'files_list': [],
             'merge_commit': True,
             'repos': ['file:///gitshow.sample'],
             'sha': '8e1cc08e799a83ace198ee7a3c6f9169635e7f46',
             'ttl': 0},
            {'author_date': 1352117713,
             'author_email': '',
             'author_email_domain': '',
             'author_name': '*****@*****.**',
             'commit_msg': '',
             'committer_date': 1352117713,
             'committer_email': '',
             'committer_name': '*****@*****.**',
             'files_list': [],
             'line_modifieds': 0,
             'merge_commit': False,
             'repos': ['file:///gitshow.sample'],
             'sha': '1c939e7487986f1ada02f1414f6101b7cd696824',
             'ttl': 0},
            ]

        self.assertListEqual(output, expected)