code
stringlengths
3
6.57k
self._validate(git_cl.ParseIssueNumberArgument(arg, codereview_hint)
test('123', 123)
test('', fail=True)
test('abc', fail=True)
test('123/1', fail=True)
test('123a', fail=True)
test('ssh://chrome-review.source.com/#/c/123/4/', fail=True)
test('https://chrome-review.source.com/bad/123/4', fail=True)
GitCookiesCheckerTest(TestCase)
setUp(self)
super(GitCookiesCheckerTest, self)
setUp()
git_cl._GitCookiesChecker()
mock_hosts_creds(self, subhost_identity_pairs)
ensure_googlesource(h)
h.endswith(self.c._GOOGLESOURCE)
h.endswith('.')
ensure_googlesource(h)
test_identity_parsing(self)
self.assertEqual(self.c._parse_identity('ldap.google.com')
self.assertEqual(self.c._parse_identity('git-ldap.example.com')
self.assertEqual(self.c._parse_identity('git-note.period.chromium.org')
self.assertEqual(self.c._parse_identity('git-note.period.example.com')
test_analysis_nothing(self)
self.assertFalse(self.c.has_generic_host()
self.assertEqual(set()
self.c.get_conflicting_hosts()
self.assertEqual(set()
self.c.get_duplicated_hosts()
self.assertEqual(set()
self.c.get_partially_configured_hosts()
self.assertEqual(set()
self.c.get_hosts_with_wrong_identities()
test_analysis(self)
self.assertTrue(self.c.has_generic_host()
self.assertEqual(set(['conflict.googlesource.com'])
self.c.get_conflicting_hosts()
self.assertEqual(set(['dup.googlesource.com'])
self.c.get_duplicated_hosts()
self.c.get_partially_configured_hosts()
self.c.get_hosts_with_wrong_identities()
test_report_no_problems(self)
self.test_analysis_nothing()
self.mock(sys, 'stdout', StringIO.StringIO()
self.assertFalse(self.c.find_and_report_problems()
self.assertEqual(sys.stdout.getvalue()
test_report(self)
self.test_analysis()
self.mock(sys, 'stdout', StringIO.StringIO()
classmethod(lambda _: '~/.gitcookies')
self.assertTrue(self.c.find_and_report_problems()
open(os.path.join(os.path.dirname(__file__)
f.read()
by_line(text)
l.rstrip()
text.rstrip()
splitlines()
self.assertEqual(by_line(sys.stdout.getvalue()
strip()
by_line(expected)
TestGitCl(TestCase)
setUp(self)
super(TestGitCl, self)
setUp()
self._mocked_call('time.time')
self._mocked_call('add_repeated', *a)
self.mock(subprocess2, 'call', self._mocked_call)
self.mock(subprocess2, 'check_call', self._mocked_call)
self.mock(subprocess2, 'check_output', self._mocked_call)
self._mocked_call(*a, **kw)
self.mock(git_cl.gclient_utils, 'CheckCallAndFilter', self._mocked_call)
self.mock(git_common, 'is_dirty_git_tree', lambda x: False)
self._mocked_call(['get_or_create_merge_base']+list(a)
self.mock(git_cl, 'BranchExists', lambda _: True)
self.mock(git_cl, 'FindCodereviewSettingsFile', lambda: '')
self._mocked_call('SaveDescriptionBackup')
list(a)
self._mocked_call('write_json', path, contents)
self.mock(git_cl.presubmit_support, 'DoPresubmitChecks', PresubmitMock)
self.mock(git_cl.checkout, 'GitCheckout', GitCheckoutMock)
GitCheckoutMock.reset()
self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock)
self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock)
self._mocked_call('SetReview', h, i, msg, labels, notify)
staticmethod(lambda: False)
classmethod(lambda _: False)
self._mocked_call('ValidAccounts', host, accounts)
self._mocked_call(['DieWithError', msg])
tearDown(self)
self.assertEquals([], self.calls)
self.has_failed()
has_failed()
super(TestGitCl, self)
tearDown()
_mocked_call(self, *args, **_kwargs)
len(self._calls_done)
self.calls.pop(0)
len(self._calls_done)
enumerate(self._calls_done[-N:])
len(self._calls_done)