Mercurial > kallithea
comparison 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 |
comparison
equal
deleted
inserted
replaced
468:9dd372c7166c | 469:e94f4e54dc03 |
---|---|
1 from pylons_app.tests import * | 1 from pylons_app.tests import * |
2 from pylons_app.lib.indexers import IDX_LOCATION | |
3 import os | |
4 from nose.plugins.skip import SkipTest | |
2 | 5 |
3 class TestSearchController(TestController): | 6 class TestSearchController(TestController): |
4 | 7 |
5 def test_index(self): | 8 def test_index(self): |
6 self.log_user() | 9 self.log_user() |
8 print response.body | 11 print response.body |
9 assert 'class="small" id="q" name="q" type="text"' in response.body,'Search box content error' | 12 assert 'class="small" id="q" name="q" type="text"' in response.body,'Search box content error' |
10 # Test response... | 13 # Test response... |
11 | 14 |
12 def test_empty_search(self): | 15 def test_empty_search(self): |
16 | |
17 if os.path.isdir(IDX_LOCATION): | |
18 raise SkipTest('skipped due to existing index') | |
19 else: | |
20 self.log_user() | |
21 response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'}) | |
22 assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index' | |
23 | |
24 def test_normal_search(self): | |
13 self.log_user() | 25 self.log_user() |
14 response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'}) | 26 response = self.app.get(url(controller='search', action='index'),{'q':'def+repo'}) |
15 assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index' | 27 print response.body |
28 assert '9 results' in response.body,'no message about proper search results' | |
29 |