Mercurial > kallithea
annotate rhodecode/tests/functional/test_search.py @ 1126:e654898120b6 beta
sorted tags by date in tag view
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 11 Mar 2011 15:56:52 +0100 |
parents | 8acbfa837180 |
children | 6832ef664673 |
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')) |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
10 print response.body |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
11 assert 'class="small" id="q" name="q" type="text"' in response.body, 'Search box content error' |
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() |
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
|
19 response = self.app.get(url(controller='search', action='index'), {'q':HG_REPO}) |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
20 assert 'There is no index to search in. Please run whoosh indexer' in response.body, 'No error message about empty index' |
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
|
21 |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
22 def test_normal_search(self): |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
23 self.log_user() |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
24 response = self.app.get(url(controller='search', action='index'), {'q':'def repo'}) |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
25 print response.body |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
26 assert '10 results' in response.body, 'no message about proper search results' |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
27 assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user' |
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
|
28 |
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() |
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
|
32 response = self.app.get(url(controller='search', action='index'), {'q':'repository:%s def test' % HG_REPO}) |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
33 print response.body |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
34 assert '4 results' in response.body, 'no message about proper search results' |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
35 assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user' |
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
|
36 |