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