diff rhodecode/tests/functional/test_search.py @ 2640:5f21a9dcb09d beta

create an index for commit messages and the ability to search them and see results
author Indra Talip <indra.talip@gmail.com>
date Fri, 20 Jul 2012 12:50:56 +0200
parents 9492ab68331f
children 2ad50c44b025
line wrap: on
line diff
--- a/rhodecode/tests/functional/test_search.py	Wed Jul 18 22:07:46 2012 +0200
+++ b/rhodecode/tests/functional/test_search.py	Fri Jul 20 12:50:56 2012 +0200
@@ -27,7 +27,7 @@
         self.log_user()
         response = self.app.get(url(controller='search', action='index'),
                                 {'q': 'def repo'})
-        response.mustcontain('39 results')
+        response.mustcontain('10 results')
 
     def test_repo_search(self):
         self.log_user()
@@ -35,3 +35,44 @@
                                 {'q': 'repository:%s def test' % HG_REPO})
 
         response.mustcontain('4 results')
+
+    def test_search_last(self):
+        self.log_user()
+        response = self.app.get(url(controller='search', action='index'),
+                                {'q': 'last:t', 'type': 'commit'})
+
+        response.mustcontain('1 results')
+
+    def test_search_commit_message(self):
+        self.log_user()
+        response = self.app.get(url(controller='search', action='index'),
+                                {'q': 'bother to ask where to fetch repo during tests',
+                                 'type': 'commit'})
+
+        response.mustcontain('1 results')
+        response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1')
+
+    def test_search_commit_changed_file(self):
+        self.log_user()
+        response = self.app.get(url(controller='search', action='index'),
+                                {'q': 'changed:tests/utils.py',
+                                 'type': 'commit'})
+
+        response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1')
+
+    def test_search_commit_added_file(self):
+        self.log_user()
+        response = self.app.get(url(controller='search', action='index'),
+                                {'q': 'added:README.rst',
+                                 'type': 'commit'})
+
+        response.mustcontain('1 results')
+        response.mustcontain('3803844fdbd3b711175fc3da9bdacfcd6d29a6fb')
+
+    def test_search_author(self):
+        self.log_user()
+        response = self.app.get(url(controller='search', action='index'),
+                                {'q': 'author:marcin@python-blog.com revision:0',
+                                 'type': 'commit'})
+
+        response.mustcontain('1 results')