Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1814)

Unified Diff: tests/tree_status_test.py

Issue 68113009: Adding support for NOTREECHECKS (Closed) Base URL: https://src.chromium.org/chrome/trunk/tools/commit-queue/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | verification/tree_status.py » ('j') | verification/tree_status.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/tree_status_test.py
===================================================================
--- tests/tree_status_test.py (revision 234489)
+++ tests/tree_status_test.py (working copy)
@@ -32,7 +32,6 @@
self.mock(urllib2, 'urlopen', self._urlopen)
def tearDown(self):
- self.assertEqual([], self.urlrequests)
super(TreeStatusTest, self).setUp()
def _urlopen(self, _):
@@ -61,6 +60,7 @@
obj = tree_status.TreeStatus(tree_status_url='foo')
self.assertEqual(True, obj.postpone())
self.assertEqual(u'Tree is currently not open: Bar', obj.why_not())
+ self.assertEqual([], self.urlrequests)
def test_pass(self):
self.urlrequests = [
@@ -85,10 +85,40 @@
obj = tree_status.TreeStatus(tree_status_url='foo')
self.assertEqual(False, obj.postpone())
self.assertEqual(None, obj.why_not())
+ self.assertEqual([], self.urlrequests)
+ def test_skip_tree_check(self):
+ self.urlrequests = [
+ [
+ {
+ 'date': '2010-01-01 11:56:00.0',
+ 'general_state': 'open',
+ 'message': 'Foo',
+ },
+ {
+ 'date': '2010-01-01 11:57:00.0',
+ 'general_state': 'closed',
+ 'message': 'Bar',
+ },
+ {
+ 'date': '2010-01-01 11:58:00.0',
+ 'general_state': 'open',
+ 'message': 'Baz',
+ },
+ ],
+ ]
+ skipped_description = 'foobarbaz\nNOTREECHECKS=true\nfoobarbaz'
+ obj = tree_status.TreeStatus(tree_status_url='foo',
+ description=skipped_description)
+ self.assertEqual(False, obj.postpone())
+ self.assertEqual(None, obj.why_not())
+ # None of the urls should have been opened since it is a skip request.
+ self.assertTrue(len(self.urlrequests[0]) == 3)
+
def test_state(self):
t = tree_status.TreeStatus(tree_status_url='foo')
self.assertEqual(tree_status.base.SUCCEEDED, t.get_state())
+ self.assertEqual([], self.urlrequests)
if __name__ == '__main__':
« no previous file with comments | « no previous file | verification/tree_status.py » ('j') | verification/tree_status.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698