Mercurial > kallithea
annotate rhodecode/tests/__init__.py @ 679:d85b0948e539 rhodecode-0.0.1.0.2
fixed hooks broken symlink issue
fixed python2.5 crash.
fixed #58 missing graph.js bug
Fixed tests to remove the forked repository when building enviroment
version bump
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 11 Nov 2010 15:03:40 +0100 |
parents | 45e1fdc0082c |
children | 3d0661b8aaa4 |
rev | line source |
---|---|
0 | 1 """Pylons application test package |
2 | |
3 This package assumes the Pylons environment is already loaded, such as | |
4 when this script is imported from the `nosetests --with-pylons=test.ini` | |
5 command. | |
6 | |
7 This module initializes the application via ``websetup`` (`paster | |
8 setup-app`) and provides the base testing objects. | |
9 """ | |
10 from unittest import TestCase | |
11 | |
12 from paste.deploy import loadapp | |
13 from paste.script.appinstall import SetupCommand | |
14 from pylons import config, url | |
15 from routes.util import URLGenerator | |
16 from webtest import TestApp | |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
17 import os |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
535
diff
changeset
|
18 from rhodecode.model import meta |
473
6b934c9607e7
Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
19 import logging |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
483
diff
changeset
|
20 |
639
45e1fdc0082c
Version bump,freeze of dependent libs.
Marcin Kuzminski <marcin@python-works.com>
parents:
548
diff
changeset
|
21 log = logging.getLogger(__name__) |
473
6b934c9607e7
Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
22 |
0 | 23 import pylons.test |
24 | |
25 __all__ = ['environ', 'url', 'TestController'] | |
26 | |
27 # Invoke websetup with the current config file | |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
483
diff
changeset
|
28 #SetupCommand('setup-app').run([config_file]) |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
483
diff
changeset
|
29 |
535
72778dda34cf
some fixups in cache, added fallback and cache invalidation when key not found in cached repos list,
Marcin Kuzminski <marcin@python-works.com>
parents:
534
diff
changeset
|
30 ##RUNNING DESIRED TESTS |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
535
diff
changeset
|
31 #nosetests rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account |
0 | 32 |
33 environ = {} | |
639
45e1fdc0082c
Version bump,freeze of dependent libs.
Marcin Kuzminski <marcin@python-works.com>
parents:
548
diff
changeset
|
34 TEST_DIR = '/tmp' |
45e1fdc0082c
Version bump,freeze of dependent libs.
Marcin Kuzminski <marcin@python-works.com>
parents:
548
diff
changeset
|
35 REPO_PATH = os.path.join(TEST_DIR, 'vcs_test') |
45e1fdc0082c
Version bump,freeze of dependent libs.
Marcin Kuzminski <marcin@python-works.com>
parents:
548
diff
changeset
|
36 NEW_REPO_PATH = os.path.join(TEST_DIR, 'vcs_test_new') |
679
d85b0948e539
fixed hooks broken symlink issue
Marcin Kuzminski <marcin@python-works.com>
parents:
639
diff
changeset
|
37 FORK_REPO_PATH = os.path.join(TEST_DIR, 'vcs_test_fork') |
0 | 38 |
39 class TestController(TestCase): | |
40 | |
41 def __init__(self, *args, **kwargs): | |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
42 wsgiapp = pylons.test.pylonsapp |
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
43 config = wsgiapp.config |
0 | 44 self.app = TestApp(wsgiapp) |
45 url._push_object(URLGenerator(config['routes.map'], environ)) | |
463
a03250279b15
test for register page
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
46 self.sa = meta.Session |
483
a9e50dce3081
Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents:
473
diff
changeset
|
47 |
0 | 48 TestCase.__init__(self, *args, **kwargs) |
639
45e1fdc0082c
Version bump,freeze of dependent libs.
Marcin Kuzminski <marcin@python-works.com>
parents:
548
diff
changeset
|
49 |
533
53aa1ee1af86
updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents:
491
diff
changeset
|
50 def log_user(self, username='test_admin', password='test12'): |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
463
diff
changeset
|
51 response = self.app.post(url(controller='login', action='index'), |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
483
diff
changeset
|
52 {'username':username, |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
483
diff
changeset
|
53 'password':password}) |
534
12c976209b2e
fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents:
533
diff
changeset
|
54 print response |
639
45e1fdc0082c
Version bump,freeze of dependent libs.
Marcin Kuzminski <marcin@python-works.com>
parents:
548
diff
changeset
|
55 |
534
12c976209b2e
fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents:
533
diff
changeset
|
56 if 'invalid user name' in response.body: |
12c976209b2e
fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents:
533
diff
changeset
|
57 assert False, 'could not login using %s %s' % (username, password) |
639
45e1fdc0082c
Version bump,freeze of dependent libs.
Marcin Kuzminski <marcin@python-works.com>
parents:
548
diff
changeset
|
58 |
464
cbe777be5b8c
some more basic tests
Marcin Kuzminski <marcin@python-works.com>
parents:
463
diff
changeset
|
59 assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status |
548
b75b77ef649d
renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
60 assert response.session['rhodecode_user'].username == username, 'wrong logged in user got %s expected %s' % (response.session['rhodecode_user'].username, username) |
473
6b934c9607e7
Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents:
469
diff
changeset
|
61 return response.follow() |