comparison rhodecode/tests/__init__.py @ 1366:9c0f5d558789 beta

fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached to db repository instance, and then fetched from cache. Also made all current test work.
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 07 Jun 2011 17:58:51 +0200
parents 15b60f83420c
children c310e1e1e757
comparison
equal deleted inserted replaced
1365:cd865113423e 1366:9c0f5d558789
5 command. 5 command.
6 6
7 This module initializes the application via ``websetup`` (`paster 7 This module initializes the application via ``websetup`` (`paster
8 setup-app`) and provides the base testing objects. 8 setup-app`) and provides the base testing objects.
9 """ 9 """
10 import os
11 from os.path import join as jn
12
10 from unittest import TestCase 13 from unittest import TestCase
11 14
12 from paste.deploy import loadapp 15 from paste.deploy import loadapp
13 from paste.script.appinstall import SetupCommand 16 from paste.script.appinstall import SetupCommand
14 from pylons import config, url 17 from pylons import config, url
15 from routes.util import URLGenerator 18 from routes.util import URLGenerator
16 from webtest import TestApp 19 from webtest import TestApp
17 import os 20
18 from rhodecode.model import meta 21 from rhodecode.model import meta
19 import logging 22 import logging
20 23
21 24
22 log = logging.getLogger(__name__) 25 log = logging.getLogger(__name__)
33 #nosetests -x rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account 36 #nosetests -x rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account
34 37
35 environ = {} 38 environ = {}
36 39
37 #SOME GLOBALS FOR TESTS 40 #SOME GLOBALS FOR TESTS
38 TESTS_TMP_PATH = '/tmp' 41 TESTS_TMP_PATH = jn('/', 'tmp')
39 42
40 HG_REPO = 'vcs_test_hg' 43 HG_REPO = 'vcs_test_hg'
41 GIT_REPO = 'vcs_test_git' 44 GIT_REPO = 'vcs_test_git'
42 45
43 NEW_HG_REPO = 'vcs_test_hg_new' 46 NEW_HG_REPO = 'vcs_test_hg_new'
62 response = self.app.post(url(controller='login', action='index'), 65 response = self.app.post(url(controller='login', action='index'),
63 {'username':username, 66 {'username':username,
64 'password':password}) 67 'password':password})
65 68
66 if 'invalid user name' in response.body: 69 if 'invalid user name' in response.body:
67 assert False, 'could not login using %s %s' % (username, password) 70 self.fail('could not login using %s %s' % (username, password))
68 71
69 assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status 72 self.assertEqual(response.status, '302 Found')
70 assert response.session['rhodecode_user'].username == username, 'wrong logged in user got %s expected %s' % (response.session['rhodecode_user'].username, username) 73 self.assertEqual(response.session['rhodecode_user'].username, username)
71 return response.follow() 74 return response.follow()