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

Unified Diff: appengine/monorail/features/test/filterrules_views_test.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months 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
Index: appengine/monorail/features/test/filterrules_views_test.py
diff --git a/appengine/monorail/features/test/filterrules_views_test.py b/appengine/monorail/features/test/filterrules_views_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..124db4fa72cd18bb5c99d22971710581f700b14d
--- /dev/null
+++ b/appengine/monorail/features/test/filterrules_views_test.py
@@ -0,0 +1,71 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Unittest for issue tracker views."""
+
+import unittest
+
+from features import filterrules_views
+from proto import tracker_pb2
+from testing import testing_helpers
+
+
+class RuleViewTest(unittest.TestCase):
+
+ def setUp(self):
+ self.rule = tracker_pb2.FilterRule()
+ self.rule.predicate = 'label:a label:b'
+
+ def testEmpty(self):
+ view = filterrules_views.RuleView(self.rule, {})
+ self.rule.predicate = ''
+ self.assertEquals('', view.predicate)
+ self.assertEquals('', view.action_type)
+ self.assertEquals('', view.action_value)
+
+ def testDefaultStatus(self):
+ self.rule.default_status = 'Unknown'
+ view = filterrules_views.RuleView(self.rule, {})
+ self.assertEquals('label:a label:b', view.predicate)
+ self.assertEquals('default_status', view.action_type)
+ self.assertEquals('Unknown', view.action_value)
+
+ def testDefaultOwner(self):
+ self.rule.default_owner_id = 111L
+ view = filterrules_views.RuleView(
+ self.rule, {
+ 111L: testing_helpers.Blank(email='jrobbins@chromium.org')})
+ self.assertEquals('label:a label:b', view.predicate)
+ self.assertEquals('default_owner', view.action_type)
+ self.assertEquals('jrobbins@chromium.org', view.action_value)
+
+ def testAddCCs(self):
+ self.rule.add_cc_ids.extend([111L, 222L])
+ view = filterrules_views.RuleView(
+ self.rule, {
+ 111L: testing_helpers.Blank(email='jrobbins@chromium.org'),
+ 222L: testing_helpers.Blank(email='jrobbins@gmail.com')})
+ self.assertEquals('label:a label:b', view.predicate)
+ self.assertEquals('add_ccs', view.action_type)
+ self.assertEquals('jrobbins@chromium.org, jrobbins@gmail.com',
+ view.action_value)
+
+ def testAddLabels(self):
+ self.rule.add_labels.extend(['Hot', 'Cool'])
+ view = filterrules_views.RuleView(self.rule, {})
+ self.assertEquals('label:a label:b', view.predicate)
+ self.assertEquals('add_labels', view.action_type)
+ self.assertEquals('Hot, Cool', view.action_value)
+
+ def testAlsoNotify(self):
+ self.rule.add_notify_addrs.extend(['a@dom.com', 'b@dom.com'])
+ view = filterrules_views.RuleView(self.rule, {})
+ self.assertEquals('label:a label:b', view.predicate)
+ self.assertEquals('also_notify', view.action_type)
+ self.assertEquals('a@dom.com, b@dom.com', view.action_value)
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « appengine/monorail/features/test/filterrules_helpers_test.py ('k') | appengine/monorail/features/test/inboundemail_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698