Mercurial > kallithea
annotate rhodecode/tests/functional/test_search.py @ 3486:2053053e0882 beta
compare/pullrequest: introduce merge parameter
This is more correct and flexible than the old way of looking on same/different
repo.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 05 Mar 2013 11:55:01 +0100 |
parents | f4ce9416cbd5 |
children | 63e49418a4cc |
rev | line source |
---|---|
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2451
diff
changeset
|
1 import os |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
483
diff
changeset
|
2 from rhodecode.tests import * |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
3 from nose.plugins.skip import SkipTest |
406
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 |
2451
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
1401
diff
changeset
|
5 |
406
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 class TestSearchController(TestController): |
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 |
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 def test_index(self): |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
9 self.log_user() |
406
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 response = self.app.get(url(controller='search', action='index')) |
1401
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
11 |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
12 self.assertTrue('class="small" id="q" name="q" type="text"' in |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
13 response.body) |
406
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 # Test response... |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
15 |
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
16 def test_empty_search(self): |
688
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
17 if os.path.isdir(self.index_location): |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
18 raise SkipTest('skipped due to existing index') |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
19 else: |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
20 self.log_user() |
1401
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
21 response = self.app.get(url(controller='search', action='index'), |
2451
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
1401
diff
changeset
|
22 {'q': HG_REPO}) |
1401
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
23 self.assertTrue('There is no index to search in. ' |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
24 'Please run whoosh indexer' in response.body) |
688
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
25 |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
26 def test_normal_search(self): |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
27 self.log_user() |
1401
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
28 response = self.app.get(url(controller='search', action='index'), |
2451
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
1401
diff
changeset
|
29 {'q': 'def repo'}) |
2644
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
30 response.mustcontain('39 results') |
688
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
31 |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
32 def test_repo_search(self): |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
33 self.log_user() |
1401
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
34 response = self.app.get(url(controller='search', action='index'), |
2451
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
1401
diff
changeset
|
35 {'q': 'repository:%s def test' % HG_REPO}) |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
1401
diff
changeset
|
36 |
402a96fcfa22
Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
1401
diff
changeset
|
37 response.mustcontain('4 results') |
2640
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
38 |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
39 def test_search_last(self): |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
40 self.log_user() |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
41 response = self.app.get(url(controller='search', action='index'), |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
42 {'q': 'last:t', 'type': 'commit'}) |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
43 |
2644
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
44 response.mustcontain('2 results') |
2640
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
45 |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
46 def test_search_commit_message(self): |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
47 self.log_user() |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
48 response = self.app.get(url(controller='search', action='index'), |
2644
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
49 {'q': 'bother to ask where to fetch repo during tests', |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
50 'type': 'commit'}) |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
51 |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
52 response.mustcontain('2 results') |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
53 response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1') |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
54 response.mustcontain('c6eb379775c578a95dad8ddab53f963b80894850') |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
55 |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
56 def test_search_commit_message_hg_repo(self): |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
57 self.log_user() |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
58 response = self.app.get(url(controller='search', action='index', |
3291 | 59 repo_name=HG_REPO), |
2644
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
60 {'q': 'bother to ask where to fetch repo during tests', |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
61 'type': 'commit'}) |
2640
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
62 |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
63 response.mustcontain('1 results') |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
64 response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1') |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
65 |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
66 def test_search_commit_changed_file(self): |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
67 self.log_user() |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
68 response = self.app.get(url(controller='search', action='index'), |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
69 {'q': 'changed:tests/utils.py', |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
70 'type': 'commit'}) |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
71 |
2740
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
72 response.mustcontain('20 results') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
73 |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
74 def test_search_commit_changed_files_get_commit(self): |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
75 self.log_user() |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
76 response = self.app.get(url(controller='search', action='index'), |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
77 {'q': 'changed:vcs/utils/lazy.py', |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
78 'type': 'commit'}) |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
79 |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
80 response.mustcontain('7 results') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
81 response.mustcontain('36e0fc9d2808c5022a24f49d6658330383ed8666') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
82 response.mustcontain('af182745859d779f17336241a0815d15166ae1ee') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
83 response.mustcontain('17438a11f72b93f56d0e08e7d1fa79a378578a82') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
84 response.mustcontain('33fa3223355104431402a888fa77a4e9956feb3e') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
85 response.mustcontain('d1f898326327e20524fe22417c22d71064fe54a1') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
86 response.mustcontain('fe568b4081755c12abf6ba673ba777fc02a415f3') |
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
87 response.mustcontain('bafe786f0d8c2ff7da5c1dcfcfa577de0b5e92f1') |
2640
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
88 |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
89 def test_search_commit_added_file(self): |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
90 self.log_user() |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
91 response = self.app.get(url(controller='search', action='index'), |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
92 {'q': 'added:README.rst', |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
93 'type': 'commit'}) |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
94 |
2644
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
95 response.mustcontain('2 results') |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
96 #HG |
2640
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
97 response.mustcontain('3803844fdbd3b711175fc3da9bdacfcd6d29a6fb') |
2644
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
98 #GIT |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
99 response.mustcontain('ff7ca51e58c505fec0dd2491de52c622bb7a806b') |
2640
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
100 |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
101 def test_search_author(self): |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
102 self.log_user() |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
103 response = self.app.get(url(controller='search', action='index'), |
2644
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
104 {'q': 'author:marcin@python-blog.com raw_id:b986218ba1c9b0d6a259fac9b050b1724ed8e545', |
bed929b24f63
fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents:
2643
diff
changeset
|
105 'type': 'commit'}) |
2640
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
106 |
5f21a9dcb09d
create an index for commit messages and the ability to search them and see results
Indra Talip <indra.talip@gmail.com>
parents:
2459
diff
changeset
|
107 response.mustcontain('1 results') |
2718
82fb2a161ddf
fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents:
2644
diff
changeset
|
108 |
82fb2a161ddf
fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents:
2644
diff
changeset
|
109 def test_search_file_name(self): |
82fb2a161ddf
fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents:
2644
diff
changeset
|
110 self.log_user() |
82fb2a161ddf
fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents:
2644
diff
changeset
|
111 response = self.app.get(url(controller='search', action='index'), |
82fb2a161ddf
fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents:
2644
diff
changeset
|
112 {'q': 'README.rst', 'type': 'path'}) |
82fb2a161ddf
fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents:
2644
diff
changeset
|
113 |
2740
8ee8f4dc16df
changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents:
2718
diff
changeset
|
114 response.mustcontain('2 results') |