Mercurial > kallithea
annotate pylons_app/tests/functional/test_search.py @ 469:e94f4e54dc03
tests fix, put vcs testing tarball
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 11 Sep 2010 03:35:33 +0200 |
parents | cbe777be5b8c |
children | a9e50dce3081 |
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 |
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
406
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() |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
21 response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'}) |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
22 assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index' |
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() |
469
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
26 response = self.app.get(url(controller='search', action='index'),{'q':'def+repo'}) |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
27 print response.body |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
28 assert '9 results' in response.body,'no message about proper search results' |
e94f4e54dc03
tests fix, put vcs testing tarball
Marcin Kuzminski <marcin@python-works.com>
parents:
464
diff
changeset
|
29 |