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

Unified Diff: appengine/monorail/search/test/searchpipeline_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
« no previous file with comments | « appengine/monorail/search/test/query2ast_test.py ('k') | appengine/monorail/services/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/search/test/searchpipeline_test.py
diff --git a/appengine/monorail/search/test/searchpipeline_test.py b/appengine/monorail/search/test/searchpipeline_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..bf0b6be956eb7473523fc26021f411eba2a60384
--- /dev/null
+++ b/appengine/monorail/search/test/searchpipeline_test.py
@@ -0,0 +1,73 @@
+# 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
+
+"""Tests for the searchpipeline module."""
+
+import unittest
+
+from proto import ast_pb2
+from proto import tracker_pb2
+from search import searchpipeline
+from services import service_manager
+from testing import fake
+from tracker import tracker_bizobj
+
+
+class SearchPipelineTest(unittest.TestCase):
+
+ def setUp(self):
+ self.cnxn = 'fake cnxn'
+ self.config = tracker_bizobj.MakeDefaultProjectIssueConfig(789)
+ self.services = service_manager.Services(
+ user=fake.UserService(),
+ project=fake.ProjectService(),
+ issue=fake.IssueService(),
+ config=fake.ConfigService())
+ self.services.user.TestAddUser('a@example.com', 111L)
+
+ def testIsStarredRE(self):
+ """IS_STARRED_RE matches only the is:starred term."""
+ input_output = {
+ 'something:else': 'something:else',
+ 'genesis:starred': 'genesis:starred',
+ 'is:starred-in-bookmarks': 'is:starred-in-bookmarks',
+ 'is:starred': 'foo',
+ 'Is:starred': 'foo',
+ 'is:STARRED': 'foo',
+ 'is:starred is:open': 'foo is:open',
+ 'is:open is:starred': 'is:open foo',
+ }
+ for i, o in input_output.items():
+ self.assertEqual(o, searchpipeline.IS_STARRED_RE.sub('foo', i))
+
+ def testMeRE(self):
+ """ME_RE matches only the 'me' value keyword."""
+ input_output = {
+ 'something:else': 'something:else',
+ 'else:some': 'else:some',
+ 'me': 'me', # It needs to have a ":" in front.
+ 'cc:me-team': 'cc:me-team',
+ 'cc:me=domain@otherdomain': 'cc:me=domain@otherdomain',
+ 'cc:me@example.com': 'cc:me@example.com',
+ 'me:the-boss': 'me:the-boss',
+ 'cc:me': 'cc:foo',
+ 'cc=me': 'cc=foo',
+ 'owner:Me': 'owner:foo',
+ 'reporter:ME': 'reporter:foo',
+ 'cc:me is:open': 'cc:foo is:open',
+ 'is:open cc:me': 'is:open cc:foo',
+ }
+ for i, o in input_output.items():
+ self.assertEqual(o, searchpipeline.ME_RE.sub('foo', i))
+
+ def testAccumulateIssueProjectsAndConfigs(self):
+ pass # TODO(jrobbins): write tests
+
+ def testReplaceKeywordsWithUserID(self):
+ pass # TODO(jrobbins): write tests
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « appengine/monorail/search/test/query2ast_test.py ('k') | appengine/monorail/services/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698