annotate rhodecode/tests/functional/test_search.py @ 3654:ec6354949623 beta

Fix a lot of casings - use standard casing in most places
author Mads Kiilerich <madski@unity3d.com>
date Wed, 03 Apr 2013 17:19:47 +0200
parents 63e49418a4cc
children d7488551578e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 *
406
b153a51b1d3b Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1401
diff changeset
4
406
b153a51b1d3b Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 class TestSearchController(TestController):
b153a51b1d3b Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6
b153a51b1d3b Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 def test_index(self):
464
cbe777be5b8c some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents: 406
diff changeset
8 self.log_user()
406
b153a51b1d3b Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 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
10
3646
63e49418a4cc Use only mustcontain for testing response body
Marcin Kuzminski <marcin@python-works.com>
parents: 3291
diff changeset
11 response.mustcontain('class="small" id="q" name="q" type="text"')
406
b153a51b1d3b Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 # Test response...
464
cbe777be5b8c some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents: 406
diff changeset
13
cbe777be5b8c some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents: 406
diff changeset
14 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
15 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
16 raise SkipTest('skipped due to existing index')
e94f4e54dc03 tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents: 464
diff changeset
17 else:
e94f4e54dc03 tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents: 464
diff changeset
18 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
19 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
20 {'q': HG_REPO})
3646
63e49418a4cc Use only mustcontain for testing response body
Marcin Kuzminski <marcin@python-works.com>
parents: 3291
diff changeset
21 response.mustcontain('There is no index to search in. '
63e49418a4cc Use only mustcontain for testing response body
Marcin Kuzminski <marcin@python-works.com>
parents: 3291
diff changeset
22 'Please run whoosh indexer')
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
23
469
e94f4e54dc03 tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents: 464
diff changeset
24 def test_normal_search(self):
464
cbe777be5b8c some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents: 406
diff changeset
25 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
26 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
27 {'q': 'def repo'})
2644
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
28 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
29
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 469
diff changeset
30 def test_repo_search(self):
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 469
diff changeset
31 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
32 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
33 {'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
34
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents: 1401
diff changeset
35 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
36
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
37 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
38 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
39 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
40 {'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
41
2644
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
42 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
43
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
44 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
45 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
46 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
47 {'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
48 'type': 'commit'})
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
49
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
50 response.mustcontain('2 results')
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
51 response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1')
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
52 response.mustcontain('c6eb379775c578a95dad8ddab53f963b80894850')
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
53
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
54 def test_search_commit_message_hg_repo(self):
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
55 self.log_user()
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
56 response = self.app.get(url(controller='search', action='index',
3291
f4ce9416cbd5 fixed tests
Marcin Kuzminski <marcin@python-works.com>
parents: 2740
diff changeset
57 repo_name=HG_REPO),
2644
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
58 {'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
59 '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
60
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
61 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
62 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
63
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 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
65 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
66 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
67 {'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
68 '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
69
2740
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
70 response.mustcontain('20 results')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
71
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
72 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
73 self.log_user()
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
74 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
75 {'q': 'changed:vcs/utils/lazy.py',
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
76 'type': 'commit'})
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
77
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
78 response.mustcontain('7 results')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
79 response.mustcontain('36e0fc9d2808c5022a24f49d6658330383ed8666')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
80 response.mustcontain('af182745859d779f17336241a0815d15166ae1ee')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
81 response.mustcontain('17438a11f72b93f56d0e08e7d1fa79a378578a82')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
82 response.mustcontain('33fa3223355104431402a888fa77a4e9956feb3e')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
83 response.mustcontain('d1f898326327e20524fe22417c22d71064fe54a1')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
84 response.mustcontain('fe568b4081755c12abf6ba673ba777fc02a415f3')
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
85 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
86
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
87 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
88 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
89 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
90 {'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
91 '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
92
2644
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
93 response.mustcontain('2 results')
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
94 #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
95 response.mustcontain('3803844fdbd3b711175fc3da9bdacfcd6d29a6fb')
2644
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
96 #GIT
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
97 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
98
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
99 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
100 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
101 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
102 {'q': 'author:marcin@python-blog.com raw_id:b986218ba1c9b0d6a259fac9b050b1724ed8e545',
bed929b24f63 fixed tests for search
Marcin Kuzminski <marcin@python-works.com>
parents: 2643
diff changeset
103 '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
104
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
105 response.mustcontain('1 results')
2718
82fb2a161ddf fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents: 2644
diff changeset
106
82fb2a161ddf fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents: 2644
diff changeset
107 def test_search_file_name(self):
82fb2a161ddf fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents: 2644
diff changeset
108 self.log_user()
82fb2a161ddf fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents: 2644
diff changeset
109 response = self.app.get(url(controller='search', action='index'),
82fb2a161ddf fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents: 2644
diff changeset
110 {'q': 'README.rst', 'type': 'path'})
82fb2a161ddf fixes issue #524
Marcin Kuzminski <marcin@python-works.com>
parents: 2644
diff changeset
111
2740
8ee8f4dc16df changed the tests for search.
Marcin Kuzminski <marcin@python-works.com>
parents: 2718
diff changeset
112 response.mustcontain('2 results')