##// END OF EJS Templates
fixed tests for search...
marcink -
r2644:bed929b2 beta
parent child Browse files
Show More
@@ -1,78 +1,92
1 1 import os
2 2 from rhodecode.tests import *
3 3 from nose.plugins.skip import SkipTest
4 4
5 5
6 6 class TestSearchController(TestController):
7 7
8 8 def test_index(self):
9 9 self.log_user()
10 10 response = self.app.get(url(controller='search', action='index'))
11 11
12 12 self.assertTrue('class="small" id="q" name="q" type="text"' in
13 13 response.body)
14 14 # Test response...
15 15
16 16 def test_empty_search(self):
17 17 if os.path.isdir(self.index_location):
18 18 raise SkipTest('skipped due to existing index')
19 19 else:
20 20 self.log_user()
21 21 response = self.app.get(url(controller='search', action='index'),
22 22 {'q': HG_REPO})
23 23 self.assertTrue('There is no index to search in. '
24 24 'Please run whoosh indexer' in response.body)
25 25
26 26 def test_normal_search(self):
27 27 self.log_user()
28 28 response = self.app.get(url(controller='search', action='index'),
29 29 {'q': 'def repo'})
30 response.mustcontain('10 results')
30 response.mustcontain('39 results')
31 31
32 32 def test_repo_search(self):
33 33 self.log_user()
34 34 response = self.app.get(url(controller='search', action='index'),
35 35 {'q': 'repository:%s def test' % HG_REPO})
36 36
37 37 response.mustcontain('4 results')
38 38
39 39 def test_search_last(self):
40 40 self.log_user()
41 41 response = self.app.get(url(controller='search', action='index'),
42 42 {'q': 'last:t', 'type': 'commit'})
43 43
44 response.mustcontain('1 results')
44 response.mustcontain('2 results')
45 45
46 46 def test_search_commit_message(self):
47 47 self.log_user()
48 48 response = self.app.get(url(controller='search', action='index'),
49 {'q': 'bother to ask where to fetch repo during tests',
50 'type': 'commit'})
49 {'q': 'bother to ask where to fetch repo during tests',
50 'type': 'commit'})
51
52 response.mustcontain('2 results')
53 response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1')
54 response.mustcontain('c6eb379775c578a95dad8ddab53f963b80894850')
55
56 def test_search_commit_message_hg_repo(self):
57 self.log_user()
58 response = self.app.get(url(controller='search', action='index',
59 search_repo=HG_REPO),
60 {'q': 'bother to ask where to fetch repo during tests',
61 'type': 'commit'})
51 62
52 63 response.mustcontain('1 results')
53 64 response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1')
54 65
55 66 def test_search_commit_changed_file(self):
56 67 self.log_user()
57 68 response = self.app.get(url(controller='search', action='index'),
58 69 {'q': 'changed:tests/utils.py',
59 70 'type': 'commit'})
60 71
61 72 response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1')
62 73
63 74 def test_search_commit_added_file(self):
64 75 self.log_user()
65 76 response = self.app.get(url(controller='search', action='index'),
66 77 {'q': 'added:README.rst',
67 78 'type': 'commit'})
68 79
69 response.mustcontain('1 results')
80 response.mustcontain('2 results')
81 #HG
70 82 response.mustcontain('3803844fdbd3b711175fc3da9bdacfcd6d29a6fb')
83 #GIT
84 response.mustcontain('ff7ca51e58c505fec0dd2491de52c622bb7a806b')
71 85
72 86 def test_search_author(self):
73 87 self.log_user()
74 88 response = self.app.get(url(controller='search', action='index'),
75 {'q': 'author:marcin@python-blog.com raw_id:b986218ba1c9b0d6a259fac9b050b1724ed8e545',
76 'type': 'commit'})
89 {'q': 'author:marcin@python-blog.com raw_id:b986218ba1c9b0d6a259fac9b050b1724ed8e545',
90 'type': 'commit'})
77 91
78 92 response.mustcontain('1 results')
General Comments 0
You need to be logged in to leave comments. Login now