Show More
@@ -1,112 +1,113 b'' | |||
|
1 | 1 | import os |
|
2 | 2 | from rhodecode.tests import * |
|
3 | 3 | |
|
4 | 4 | |
|
5 | 5 | class TestSearchController(TestController): |
|
6 | 6 | |
|
7 | 7 | def test_index(self): |
|
8 | 8 | self.log_user() |
|
9 | 9 | response = self.app.get(url(controller='search', action='index')) |
|
10 | 10 | |
|
11 | 11 | response.mustcontain('class="small" id="q" name="q" type="text"') |
|
12 | 12 | # Test response... |
|
13 | 13 | |
|
14 | 14 | def test_empty_search(self): |
|
15 | 15 | if os.path.isdir(self.index_location): |
|
16 | 16 | raise SkipTest('skipped due to existing index') |
|
17 | 17 | else: |
|
18 | 18 | self.log_user() |
|
19 | 19 | response = self.app.get(url(controller='search', action='index'), |
|
20 | 20 | {'q': HG_REPO}) |
|
21 | 21 | response.mustcontain('There is no index to search in. ' |
|
22 | 22 | 'Please run whoosh indexer') |
|
23 | 23 | |
|
24 | 24 | def test_normal_search(self): |
|
25 | 25 | self.log_user() |
|
26 | 26 | response = self.app.get(url(controller='search', action='index'), |
|
27 | 27 | {'q': 'def repo'}) |
|
28 | 28 | response.mustcontain('58 results') |
|
29 | 29 | |
|
30 | 30 | def test_repo_search(self): |
|
31 | 31 | self.log_user() |
|
32 | 32 | response = self.app.get(url(controller='search', action='index'), |
|
33 | 33 | {'q': 'repository:%s def test' % HG_REPO}) |
|
34 | 34 | |
|
35 | 35 | response.mustcontain('18 results') |
|
36 | 36 | |
|
37 | 37 | def test_search_last(self): |
|
38 | 38 | self.log_user() |
|
39 | 39 | response = self.app.get(url(controller='search', action='index'), |
|
40 | 40 | {'q': 'last:t', 'type': 'commit'}) |
|
41 | 41 | |
|
42 | 42 | response.mustcontain('2 results') |
|
43 | 43 | |
|
44 | 44 | def test_search_commit_message(self): |
|
45 | 45 | self.log_user() |
|
46 | 46 | response = self.app.get(url(controller='search', action='index'), |
|
47 | 47 | {'q': 'bother to ask where to fetch repo during tests', |
|
48 | 48 | 'type': 'commit'}) |
|
49 | 49 | |
|
50 | 50 | response.mustcontain('2 results') |
|
51 | 51 | response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1') |
|
52 | 52 | response.mustcontain('c6eb379775c578a95dad8ddab53f963b80894850') |
|
53 | 53 | |
|
54 | 54 | def test_search_commit_message_hg_repo(self): |
|
55 | 55 | self.log_user() |
|
56 | 56 | response = self.app.get(url(controller='search', action='index', |
|
57 | 57 | repo_name=HG_REPO), |
|
58 | 58 | {'q': 'bother to ask where to fetch repo during tests', |
|
59 | 59 | 'type': 'commit'}) |
|
60 | 60 | |
|
61 | 61 | response.mustcontain('1 results') |
|
62 | 62 | response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1') |
|
63 | 63 | |
|
64 | 64 | def test_search_commit_changed_file(self): |
|
65 | 65 | self.log_user() |
|
66 | 66 | response = self.app.get(url(controller='search', action='index'), |
|
67 | 67 | {'q': 'changed:tests/utils.py', |
|
68 | 68 | 'type': 'commit'}) |
|
69 | 69 | |
|
70 | 70 | response.mustcontain('29 results') |
|
71 | 71 | |
|
72 | 72 | def test_search_commit_changed_files_get_commit(self): |
|
73 | 73 | self.log_user() |
|
74 | 74 | response = self.app.get(url(controller='search', action='index'), |
|
75 |
{'q': 'changed:vcs/utils/ |
|
|
75 | {'q': 'changed:vcs/utils/archivers.py', | |
|
76 | 76 | 'type': 'commit'}) |
|
77 | 77 | |
|
78 |
response.mustcontain(' |
|
|
79 | response.mustcontain('36e0fc9d2808c5022a24f49d6658330383ed8666') | |
|
80 | response.mustcontain('af182745859d779f17336241a0815d15166ae1ee') | |
|
81 | response.mustcontain('17438a11f72b93f56d0e08e7d1fa79a378578a82') | |
|
82 | response.mustcontain('33fa3223355104431402a888fa77a4e9956feb3e') | |
|
78 | response.mustcontain('8 results') | |
|
79 | response.mustcontain('25213a5fbb048dff8ba65d21e466a835536e5b70') | |
|
80 | response.mustcontain('47aedd538bf616eedcb0e7d630ea476df0e159c7') | |
|
81 | response.mustcontain('f5d23247fad4856a1dabd5838afade1e0eed24fb') | |
|
82 | response.mustcontain('04ad456aefd6461aea24f90b63954b6b1ce07b3e') | |
|
83 | response.mustcontain('c994f0de03b2a0aa848a04fc2c0d7e737dba31fc') | |
|
83 | 84 | response.mustcontain('d1f898326327e20524fe22417c22d71064fe54a1') |
|
84 | 85 | response.mustcontain('fe568b4081755c12abf6ba673ba777fc02a415f3') |
|
85 | 86 | response.mustcontain('bafe786f0d8c2ff7da5c1dcfcfa577de0b5e92f1') |
|
86 | 87 | |
|
87 | 88 | def test_search_commit_added_file(self): |
|
88 | 89 | self.log_user() |
|
89 | 90 | response = self.app.get(url(controller='search', action='index'), |
|
90 | 91 | {'q': 'added:README.rst', |
|
91 | 92 | 'type': 'commit'}) |
|
92 | 93 | |
|
93 | 94 | response.mustcontain('2 results') |
|
94 | 95 | #HG |
|
95 | 96 | response.mustcontain('3803844fdbd3b711175fc3da9bdacfcd6d29a6fb') |
|
96 | 97 | #GIT |
|
97 | 98 | response.mustcontain('ff7ca51e58c505fec0dd2491de52c622bb7a806b') |
|
98 | 99 | |
|
99 | 100 | def test_search_author(self): |
|
100 | 101 | self.log_user() |
|
101 | 102 | response = self.app.get(url(controller='search', action='index'), |
|
102 | 103 | {'q': 'author:marcin@python-blog.com raw_id:b986218ba1c9b0d6a259fac9b050b1724ed8e545', |
|
103 | 104 | 'type': 'commit'}) |
|
104 | 105 | |
|
105 | 106 | response.mustcontain('1 results') |
|
106 | 107 | |
|
107 | 108 | def test_search_file_name(self): |
|
108 | 109 | self.log_user() |
|
109 | 110 | response = self.app.get(url(controller='search', action='index'), |
|
110 | 111 | {'q': 'README.rst', 'type': 'path'}) |
|
111 | 112 | |
|
112 | 113 | response.mustcontain('2 results') |
General Comments 0
You need to be logged in to leave comments.
Login now