Show More
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -49,10 +49,10 b' def load_environment(global_conf, app_co' | |||||
49 |
|
49 | |||
50 | #sets the c attribute access when don't existing attribute are accessed |
|
50 | #sets the c attribute access when don't existing attribute are accessed | |
51 | config['pylons.strict_tmpl_context'] = True |
|
51 | config['pylons.strict_tmpl_context'] = True | |
52 |
|
52 | test = os.path.split(config['__file__'])[-1] == 'tests.ini' | ||
53 | #MULTIPLE DB configs |
|
53 | #MULTIPLE DB configs | |
54 | # Setup the SQLAlchemy database engine |
|
54 | # Setup the SQLAlchemy database engine | |
55 |
if config['debug'] and o |
|
55 | if config['debug'] and not test: | |
56 | #use query time debugging. |
|
56 | #use query time debugging. | |
57 | from pylons_app.lib.timerproxy import TimerProxy |
|
57 | from pylons_app.lib.timerproxy import TimerProxy | |
58 | sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', |
|
58 | sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', |
@@ -31,7 +31,6 b' class TestController(TestCase):' | |||||
31 | wsgiapp = pylons.test.pylonsapp |
|
31 | wsgiapp = pylons.test.pylonsapp | |
32 | config = wsgiapp.config |
|
32 | config = wsgiapp.config | |
33 | self.app = TestApp(wsgiapp) |
|
33 | self.app = TestApp(wsgiapp) | |
34 | self.session = session |
|
|||
35 | url._push_object(URLGenerator(config['routes.map'], environ)) |
|
34 | url._push_object(URLGenerator(config['routes.map'], environ)) | |
36 | self.sa = meta.Session |
|
35 | self.sa = meta.Session | |
37 | TestCase.__init__(self, *args, **kwargs) |
|
36 | TestCase.__init__(self, *args, **kwargs) |
@@ -1,4 +1,7 b'' | |||||
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 | |||
@@ -10,6 +13,17 b' class TestSearchController(TestControlle' | |||||
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':' |
|
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' No newline at end of file |
|
27 | print response.body | |
|
28 | assert '9 results' in response.body,'no message about proper search results' | |||
|
29 |
@@ -8,7 +8,8 b' from time import mktime' | |||||
8 | import logging |
|
8 | import logging | |
9 | import os |
|
9 | import os | |
10 | import sys |
|
10 | import sys | |
11 |
import |
|
11 | import tarfile | |
|
12 | ||||
12 | log = logging.getLogger(__name__) |
|
13 | log = logging.getLogger(__name__) | |
13 |
|
14 | |||
14 | ROOT = dn(dn(os.path.realpath(__file__))) |
|
15 | ROOT = dn(dn(os.path.realpath(__file__))) | |
@@ -28,8 +29,10 b' def setup_app(command, conf, vars):' | |||||
28 |
|
29 | |||
29 | if not os.path.isdir(REPO_TEST_PATH): |
|
30 | if not os.path.isdir(REPO_TEST_PATH): | |
30 | os.mkdir(REPO_TEST_PATH) |
|
31 | os.mkdir(REPO_TEST_PATH) | |
31 | from_ = '/home/marcink/workspace-python/vcs' |
|
32 | cur_dir = dn(os.path.abspath(__file__)) | |
32 | shutil.copytree(from_, os.path.join(REPO_TEST_PATH,'vcs_test')) |
|
33 | tar = tarfile.open(jn(cur_dir,'tests',"vcs_test.tar.gz")) | |
|
34 | tar.extractall(REPO_TEST_PATH) | |||
|
35 | tar.close() | |||
33 |
|
36 | |||
34 | tests = True |
|
37 | tests = True | |
35 |
|
38 |
General Comments 0
You need to be logged in to leave comments.
Login now