Mercurial > kallithea
annotate pylons_app/tests/functional/test_search.py @ 525:87d80c84df09
added search in specific repository
added delete to my page view handled by separate controller for deleting users own repos, added fork draft
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 29 Sep 2010 22:38:54 +0200 |
parents | a9e50dce3081 |
children |
rev | line source |
---|---|
406
b153a51b1d3b
Implemented search using whoosh. Still as experimental option.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 from pylons_app.tests import * |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
2 from pylons_app.lib.indexers import IDX_LOCATION |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
3 import os |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
4 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
|
5 |
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')) |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
diff
changeset
|
11 print response.body |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
12 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
|
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): |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
16 |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
17 if os.path.isdir(IDX_LOCATION): |
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() |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
21 response = self.app.get(url(controller='search', action='index'), {'q':'vcs_test'}) |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
22 assert 'There is no index to search in. Please run whoosh indexer' in response.body, 'No error message about empty index' |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
23 |
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() |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
26 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
|
27 print response.body |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
28 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
|
29 assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user' |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
30 |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
31 |
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() |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
34 response = self.app.get(url(controller='search', action='index'), {'q':'repository:vcs_test def test'}) |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
35 print response.body |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
36 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
|
37 assert 'Permission denied' not in response.body, 'Wrong permissions settings for that repo and user' |
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
38 |