Mercurial > kallithea
comparison rhodecode/tests/__init__.py @ 639:45e1fdc0082c
Version bump,freeze of dependent libs.
Little test update
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 02 Nov 2010 20:19:05 +0100 |
parents | b75b77ef649d |
children | d85b0948e539 |
comparison
equal
deleted
inserted
replaced
632:ac6f707d1979 | 639:45e1fdc0082c |
---|---|
16 from webtest import TestApp | 16 from webtest import TestApp |
17 import os | 17 import os |
18 from rhodecode.model import meta | 18 from rhodecode.model import meta |
19 import logging | 19 import logging |
20 | 20 |
21 | 21 log = logging.getLogger(__name__) |
22 log = logging.getLogger(__name__) | |
23 | 22 |
24 import pylons.test | 23 import pylons.test |
25 | 24 |
26 __all__ = ['environ', 'url', 'TestController'] | 25 __all__ = ['environ', 'url', 'TestController'] |
27 | 26 |
30 | 29 |
31 ##RUNNING DESIRED TESTS | 30 ##RUNNING DESIRED TESTS |
32 #nosetests rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account | 31 #nosetests rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account |
33 | 32 |
34 environ = {} | 33 environ = {} |
34 TEST_DIR = '/tmp' | |
35 REPO_PATH = os.path.join(TEST_DIR, 'vcs_test') | |
36 NEW_REPO_PATH = os.path.join(TEST_DIR, 'vcs_test_new') | |
35 | 37 |
36 class TestController(TestCase): | 38 class TestController(TestCase): |
37 | 39 |
38 def __init__(self, *args, **kwargs): | 40 def __init__(self, *args, **kwargs): |
39 wsgiapp = pylons.test.pylonsapp | 41 wsgiapp = pylons.test.pylonsapp |
41 self.app = TestApp(wsgiapp) | 43 self.app = TestApp(wsgiapp) |
42 url._push_object(URLGenerator(config['routes.map'], environ)) | 44 url._push_object(URLGenerator(config['routes.map'], environ)) |
43 self.sa = meta.Session | 45 self.sa = meta.Session |
44 | 46 |
45 TestCase.__init__(self, *args, **kwargs) | 47 TestCase.__init__(self, *args, **kwargs) |
46 | 48 |
47 def log_user(self, username='test_admin', password='test12'): | 49 def log_user(self, username='test_admin', password='test12'): |
48 response = self.app.post(url(controller='login', action='index'), | 50 response = self.app.post(url(controller='login', action='index'), |
49 {'username':username, | 51 {'username':username, |
50 'password':password}) | 52 'password':password}) |
51 print response | 53 print response |
52 | 54 |
53 if 'invalid user name' in response.body: | 55 if 'invalid user name' in response.body: |
54 assert False, 'could not login using %s %s' % (username, password) | 56 assert False, 'could not login using %s %s' % (username, password) |
55 | 57 |
56 assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status | 58 assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status |
57 assert response.session['rhodecode_user'].username == username, 'wrong logged in user got %s expected %s' % (response.session['rhodecode_user'].username, username) | 59 assert response.session['rhodecode_user'].username == username, 'wrong logged in user got %s expected %s' % (response.session['rhodecode_user'].username, username) |
58 return response.follow() | 60 return response.follow() |