def test_getGitURL(self): gerrit_config = { 'user': '******', 'server': 'localhost', 'password': '******', } # The 1/ in the password ensures we test the url encoding # path; this is the format of password we get from # googlesource.com. driver = GerritDriver() gerrit = GerritConnection(driver, 'review_gerrit', gerrit_config) project = gerrit.source.getProject('org/project') url = gerrit.source.getGitUrl(project) self.assertEqual( 'https://*****:*****@localhost/org/project', url)
def run_query(self, files, expected_patches, _ssh_mock): gerrit_config = { 'user': '******', 'server': 'localhost', } driver = GerritDriver() gerrit = GerritConnection(driver, 'review_gerrit', gerrit_config) calls, values = read_fixtures(files) _ssh_mock.side_effect = values result = gerrit.simpleQuery('project:openstack-infra/zuul') _ssh_mock.assert_has_calls(calls) self.assertEqual(len(calls), _ssh_mock.call_count, '_ssh should be called %d times' % len(calls)) self.assertIsNotNone(result, 'Result is not none') self.assertEqual(len(result), expected_patches, 'There must be %d patches.' % expected_patches)