OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This is based on code from: | 5 # This is based on code from: |
6 # https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/tools/
blink_roller/auto_roll_test.py | 6 # https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/tools/
blink_roller/auto_roll_test.py |
7 # Ideally we should share code between these. | 7 # Ideally we should share code between these. |
8 | 8 |
9 | 9 |
10 from webkitpy.common.system.outputcapture import OutputCaptureTestCaseBase | 10 from webkitpy.common.system.outputcapture import OutputCaptureTestCaseBase |
11 import sheriff_calendar as calendar | 11 import sheriff_calendar as calendar |
12 | 12 |
13 | 13 |
14 class SheriffCalendarTest(OutputCaptureTestCaseBase): | 14 class SheriffCalendarTest(OutputCaptureTestCaseBase): |
| 15 |
15 def test_complete_email(self): | 16 def test_complete_email(self): |
16 expected_emails = ['foo@chromium.org', 'bar@google.com', 'baz@chromium.o
rg'] | 17 expected_emails = ['foo@chromium.org', 'bar@google.com', 'baz@chromium.o
rg'] |
17 names = ['foo', 'bar@google.com', 'baz'] | 18 names = ['foo', 'bar@google.com', 'baz'] |
18 self.assertEqual(map(calendar._complete_email, names), expected_emails) | 19 self.assertEqual(map(calendar._complete_email, names), expected_emails) |
19 | 20 |
20 def test_emails(self): | 21 def test_emails(self): |
21 expected_emails = ['foo@bar.com', 'baz@baz.com'] | 22 expected_emails = ['foo@bar.com', 'baz@baz.com'] |
22 calendar._emails_from_url = lambda urls: expected_emails | 23 calendar._emails_from_url = lambda urls: expected_emails |
23 self.assertEqual(calendar.current_gardener_emails(), expected_emails) | 24 self.assertEqual(calendar.current_gardener_emails(), expected_emails) |
24 | 25 |
(...skipping 22 matching lines...) Expand all Loading... |
47 # Bogus. | 48 # Bogus. |
48 self.assertFalse(calendar._email_is_valid('rm -rf /#@example.com')) | 49 self.assertFalse(calendar._email_is_valid('rm -rf /#@example.com')) |
49 self.assertFalse(calendar._email_is_valid('some body@example.com')) | 50 self.assertFalse(calendar._email_is_valid('some body@example.com')) |
50 self.assertFalse(calendar._email_is_valid('[some body]@example.com')) | 51 self.assertFalse(calendar._email_is_valid('[some body]@example.com')) |
51 | 52 |
52 def test_filter_emails(self): | 53 def test_filter_emails(self): |
53 input_emails = ['foo@bar.com', 'baz@baz.com', 'bogus email @ !!!'] | 54 input_emails = ['foo@bar.com', 'baz@baz.com', 'bogus email @ !!!'] |
54 expected_emails = ['foo@bar.com', 'baz@baz.com'] | 55 expected_emails = ['foo@bar.com', 'baz@baz.com'] |
55 self.assertEquals(calendar._filter_emails(input_emails), expected_emails
) | 56 self.assertEquals(calendar._filter_emails(input_emails), expected_emails
) |
56 self.assertStdout('WARNING: Not including bogus email @ !!! (invalid ema
il address)\n') | 57 self.assertStdout('WARNING: Not including bogus email @ !!! (invalid ema
il address)\n') |
OLD | NEW |