Mercurial > kallithea
annotate rhodecode/tests/functional/test_search.py @ 1718:f78bee8eec78 beta
reduce cookie size for better support of client side sessions
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 25 Nov 2011 19:25:10 +0200 |
parents | b7563ad4e7ee |
children | 402a96fcfa22 |
rev | line source |
---|---|
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
483
diff
changeset
|
1 from rhodecode.tests import * |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
2 import os |
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 |
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 |
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 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
|
12 response.body) |
406
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
13 # Test response... |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
14 |
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
15 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
|
16 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
|
17 raise SkipTest('skipped due to existing index') |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
18 else: |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
19 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
|
20 response = self.app.get(url(controller='search', action='index'), |
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 {'q':HG_REPO}) |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
22 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
|
23 '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
|
24 |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
25 def test_normal_search(self): |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
26 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
|
27 response = self.app.get(url(controller='search', action='index'), |
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 {'q':'def repo'}) |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
29 self.assertTrue('10 results' in response.body) |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
30 self.assertTrue('Permission denied' not 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
|
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'), |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
35 {'q':'repository:%s def test' % HG_REPO}) |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
36 self.assertTrue('4 results' in response.body) |
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
37 self.assertTrue('Permission denied' not in response.body) |