def test_to_gerrit_comment_with_patchset(self): pr_status_info = PRStatusInfo('bar', 123, 'num') expected = self.generate_notifier_comment(123, 'bar', 'num', 3) actual = pr_status_info.to_gerrit_comment(3) self.assertEqual(expected, actual)
def test_to_gerrit_comment_latest(self): pr_status_info = PRStatusInfo('bar', 123, None) expected = self.generate_notifier_comment(123, 'bar', 'Latest', None) actual = pr_status_info.to_gerrit_comment() self.assertEqual(expected, actual)
def test_to_gerrit_comment_with_patchset(self): checks_results = {'key1': 'val1', 'key2': 'val2'} pr_status_info = PRStatusInfo(checks_results, 123, 'SHA') expected = self.generate_notifier_comment(123, checks_results, 'SHA', 3) actual = pr_status_info.to_gerrit_comment(3) self.assertEqual(expected, actual)
def test_to_gerrit_comment_latest(self): checks_results = {'key1': 'val1', 'key2': 'val2'} pr_status_info = PRStatusInfo(checks_results, 123, None) expected = self.generate_notifier_comment(123, checks_results, 'Latest', None) actual = pr_status_info.to_gerrit_comment() self.assertEqual(expected, actual)
def test_to_gerrit_comment(self): checks_results = {'key1': 'val1', 'key2': 'val2'} result_comment = '\nkey2 (val2)\nkey1 (val1)' pr_status_info = PRStatusInfo(checks_results, 123, 'SHA') expected = self.generate_notifier_comment(123, result_comment, 'SHA', None) actual = pr_status_info.to_gerrit_comment() self.assertEqual(expected, actual)
def test_to_gerrit_comment_latest(self): pr_status_info = PRStatusInfo('bar', None) expected = ( 'The exported PR for the current patch failed Taskcluster check(s) ' 'on GitHub, which could indict cross-broswer failures on the ' 'exportable changes. Please contact ecosystem-infra@ team for ' 'more information.\n\n' 'Taskcluster Link: bar\n' 'Gerrit CL SHA: Latest') actual = pr_status_info.to_gerrit_comment() self.assertEqual(expected, actual)
def test_to_gerrit_comment_with_patchset(self): pr_status_info = PRStatusInfo('foo', 'bar', 'num') expected = ( 'The exported PR for the current patch failed Taskcluster check(s) ' 'on GitHub, which could indict cross-broswer failures on the ' 'exportable changes. Please contact ecosystem-infra@ team for ' 'more information.\n\n' 'Taskcluster Node ID: foo\n' 'Taskcluster Link: bar\n' 'Gerrit CL SHA: num\n' 'Patchset Number: 3') actual = pr_status_info.to_gerrit_comment(3) self.assertEqual(expected, actual)