Show More
@@ -96,7 +96,7 b' def load_environment(global_conf, app_co' | |||||
96 | config['sqlalchemy.url'] = os.environ.get('TEST_DB') |
|
96 | config['sqlalchemy.url'] = os.environ.get('TEST_DB') | |
97 |
|
97 | |||
98 | from kallithea.lib.utils import create_test_env, create_test_index |
|
98 | from kallithea.lib.utils import create_test_env, create_test_index | |
99 | from kallithea.tests import TESTS_TMP_PATH |
|
99 | from kallithea.tests.base import TESTS_TMP_PATH | |
100 | #set KALLITHEA_NO_TMP_PATH=1 to disable re-creating the database and |
|
100 | #set KALLITHEA_NO_TMP_PATH=1 to disable re-creating the database and | |
101 | #test repos |
|
101 | #test repos | |
102 | if test_env: |
|
102 | if test_env: |
@@ -196,7 +196,7 b' class DbManage(object):' | |||||
196 | self.create_user(username, password, email, True) |
|
196 | self.create_user(username, password, email, True) | |
197 | else: |
|
197 | else: | |
198 | log.info('creating admin and regular test users') |
|
198 | log.info('creating admin and regular test users') | |
199 | from kallithea.tests import TEST_USER_ADMIN_LOGIN, \ |
|
199 | from kallithea.tests.base import TEST_USER_ADMIN_LOGIN, \ | |
200 | TEST_USER_ADMIN_PASS, TEST_USER_ADMIN_EMAIL, \ |
|
200 | TEST_USER_ADMIN_PASS, TEST_USER_ADMIN_EMAIL, \ | |
201 | TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS, \ |
|
201 | TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS, \ | |
202 | TEST_USER_REGULAR_EMAIL, TEST_USER_REGULAR2_LOGIN, \ |
|
202 | TEST_USER_REGULAR_EMAIL, TEST_USER_REGULAR2_LOGIN, \ |
@@ -629,7 +629,7 b' def create_test_env(repos_test_path, con' | |||||
629 | install test repository into tmp dir |
|
629 | install test repository into tmp dir | |
630 | """ |
|
630 | """ | |
631 | from kallithea.lib.db_manage import DbManage |
|
631 | from kallithea.lib.db_manage import DbManage | |
632 | from kallithea.tests import HG_REPO, GIT_REPO, TESTS_TMP_PATH |
|
632 | from kallithea.tests.base import HG_REPO, GIT_REPO, TESTS_TMP_PATH | |
633 |
|
633 | |||
634 | # PART ONE create db |
|
634 | # PART ONE create db | |
635 | dbconf = config['sqlalchemy.url'] |
|
635 | dbconf = config['sqlalchemy.url'] |
@@ -17,217 +17,6 b' Kallithea test package' | |||||
17 |
|
17 | |||
18 | Refer to docs/contributing.rst for details on running the test suite. |
|
18 | Refer to docs/contributing.rst for details on running the test suite. | |
19 | """ |
|
19 | """ | |
20 | import os |
|
|||
21 | import re |
|
|||
22 | import time |
|
|||
23 | import logging |
|
|||
24 | import datetime |
|
|||
25 | import hashlib |
|
|||
26 | import tempfile |
|
|||
27 |
|
20 | |||
28 | from tempfile import _RandomNameSequence |
|
|||
29 |
|
||||
30 | import pylons |
|
|||
31 | import pylons.test |
|
|||
32 | from pylons import config, url |
|
|||
33 | from pylons.i18n.translation import _get_translator |
|
|||
34 | from pylons.util import ContextObj |
|
|||
35 |
|
||||
36 | from routes.util import URLGenerator |
|
|||
37 | from webtest import TestApp |
|
|||
38 | import pytest |
|
21 | import pytest | |
39 |
|
22 | |||
40 | from kallithea.lib.compat import unittest |
|
|||
41 | from kallithea import is_windows |
|
|||
42 | from kallithea.model.db import Notification, User, UserNotification |
|
|||
43 | from kallithea.model.meta import Session |
|
|||
44 | from kallithea.lib.utils2 import safe_str |
|
|||
45 |
|
||||
46 |
|
||||
47 | os.environ['TZ'] = 'UTC' |
|
|||
48 | if not is_windows: |
|
|||
49 | time.tzset() |
|
|||
50 |
|
||||
51 | log = logging.getLogger(__name__) |
|
|||
52 |
|
||||
53 | skipif = pytest.mark.skipif |
|
|||
54 | parametrize = pytest.mark.parametrize |
|
|||
55 |
|
||||
56 | __all__ = [ |
|
|||
57 | 'skipif', 'parametrize', 'environ', 'url', 'TestController', |
|
|||
58 | 'ldap_lib_installed', 'pam_lib_installed', 'invalidate_all_caches', |
|
|||
59 | 'TESTS_TMP_PATH', 'HG_REPO', 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', |
|
|||
60 | 'HG_FORK', 'GIT_FORK', 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_ADMIN_PASS', |
|
|||
61 | 'TEST_USER_ADMIN_EMAIL', 'TEST_USER_REGULAR_LOGIN', 'TEST_USER_REGULAR_PASS', |
|
|||
62 | 'TEST_USER_REGULAR_EMAIL', 'TEST_USER_REGULAR2_LOGIN', |
|
|||
63 | 'TEST_USER_REGULAR2_PASS', 'TEST_USER_REGULAR2_EMAIL', 'TEST_HG_REPO', |
|
|||
64 | 'TEST_HG_REPO_CLONE', 'TEST_HG_REPO_PULL', 'TEST_GIT_REPO', |
|
|||
65 | 'TEST_GIT_REPO_CLONE', 'TEST_GIT_REPO_PULL', 'HG_REMOTE_REPO', |
|
|||
66 | 'GIT_REMOTE_REPO', 'SCM_TESTS', |
|
|||
67 | ] |
|
|||
68 |
|
||||
69 | # Invoke websetup with the current config file |
|
|||
70 | # SetupCommand('setup-app').run([config_file]) |
|
|||
71 |
|
||||
72 | environ = {} |
|
|||
73 |
|
||||
74 | #SOME GLOBALS FOR TESTS |
|
|||
75 |
|
||||
76 | TESTS_TMP_PATH = os.path.join(tempfile.gettempdir(), 'rc_test_%s' % _RandomNameSequence().next()) |
|
|||
77 | TEST_USER_ADMIN_LOGIN = 'test_admin' |
|
|||
78 | TEST_USER_ADMIN_PASS = 'test12' |
|
|||
79 | TEST_USER_ADMIN_EMAIL = 'test_admin@example.com' |
|
|||
80 |
|
||||
81 | TEST_USER_REGULAR_LOGIN = 'test_regular' |
|
|||
82 | TEST_USER_REGULAR_PASS = 'test12' |
|
|||
83 | TEST_USER_REGULAR_EMAIL = 'test_regular@example.com' |
|
|||
84 |
|
||||
85 | TEST_USER_REGULAR2_LOGIN = 'test_regular2' |
|
|||
86 | TEST_USER_REGULAR2_PASS = 'test12' |
|
|||
87 | TEST_USER_REGULAR2_EMAIL = 'test_regular2@example.com' |
|
|||
88 |
|
||||
89 | HG_REPO = u'vcs_test_hg' |
|
|||
90 | GIT_REPO = u'vcs_test_git' |
|
|||
91 |
|
||||
92 | NEW_HG_REPO = u'vcs_test_hg_new' |
|
|||
93 | NEW_GIT_REPO = u'vcs_test_git_new' |
|
|||
94 |
|
||||
95 | HG_FORK = u'vcs_test_hg_fork' |
|
|||
96 | GIT_FORK = u'vcs_test_git_fork' |
|
|||
97 |
|
||||
98 | ## VCS |
|
|||
99 | SCM_TESTS = ['hg', 'git'] |
|
|||
100 | uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple()))) |
|
|||
101 |
|
||||
102 | GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git' |
|
|||
103 |
|
||||
104 | TEST_GIT_REPO = os.path.join(TESTS_TMP_PATH, GIT_REPO) |
|
|||
105 | TEST_GIT_REPO_CLONE = os.path.join(TESTS_TMP_PATH, 'vcsgitclone%s' % uniq_suffix) |
|
|||
106 | TEST_GIT_REPO_PULL = os.path.join(TESTS_TMP_PATH, 'vcsgitpull%s' % uniq_suffix) |
|
|||
107 |
|
||||
108 |
|
||||
109 | HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs' |
|
|||
110 |
|
||||
111 | TEST_HG_REPO = os.path.join(TESTS_TMP_PATH, HG_REPO) |
|
|||
112 | TEST_HG_REPO_CLONE = os.path.join(TESTS_TMP_PATH, 'vcshgclone%s' % uniq_suffix) |
|
|||
113 | TEST_HG_REPO_PULL = os.path.join(TESTS_TMP_PATH, 'vcshgpull%s' % uniq_suffix) |
|
|||
114 |
|
||||
115 | TEST_DIR = tempfile.gettempdir() |
|
|||
116 | TEST_REPO_PREFIX = 'vcs-test' |
|
|||
117 |
|
||||
118 | # cached repos if any ! |
|
|||
119 | # comment out to get some other repos from bb or github |
|
|||
120 | GIT_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, GIT_REPO) |
|
|||
121 | HG_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, HG_REPO) |
|
|||
122 |
|
||||
123 | #skip ldap tests if LDAP lib is not installed |
|
|||
124 | ldap_lib_installed = False |
|
|||
125 | try: |
|
|||
126 | import ldap |
|
|||
127 | ldap.API_VERSION |
|
|||
128 | ldap_lib_installed = True |
|
|||
129 | except ImportError: |
|
|||
130 | # means that python-ldap is not installed |
|
|||
131 | pass |
|
|||
132 |
|
||||
133 | try: |
|
|||
134 | import pam |
|
|||
135 | pam.PAM_TEXT_INFO |
|
|||
136 | pam_lib_installed = True |
|
|||
137 | except ImportError: |
|
|||
138 | pam_lib_installed = False |
|
|||
139 |
|
||||
140 | def invalidate_all_caches(): |
|
|||
141 | """Invalidate all beaker caches currently configured. |
|
|||
142 | Useful when manipulating IP permissions in a test and changes need to take |
|
|||
143 | effect immediately. |
|
|||
144 | Note: Any use of this function is probably a workaround - it should be |
|
|||
145 | replaced with a more specific cache invalidation in code or test.""" |
|
|||
146 | from beaker.cache import cache_managers |
|
|||
147 | for cache in cache_managers.values(): |
|
|||
148 | cache.clear() |
|
|||
149 |
|
||||
150 | class NullHandler(logging.Handler): |
|
|||
151 | def emit(self, record): |
|
|||
152 | pass |
|
|||
153 |
|
||||
154 | class TestController(object): |
|
|||
155 | """Pytest-style test controller""" |
|
|||
156 |
|
||||
157 | # Note: pytest base classes cannot have an __init__ method |
|
|||
158 |
|
||||
159 | @pytest.fixture(autouse=True) |
|
|||
160 | def app_fixture(self): |
|
|||
161 | self.wsgiapp = pylons.test.pylonsapp |
|
|||
162 | self.init_stack(self.wsgiapp.config) |
|
|||
163 | self.app = TestApp(self.wsgiapp) |
|
|||
164 | self.maxDiff = None |
|
|||
165 | self.index_location = config['app_conf']['index_dir'] |
|
|||
166 | return self.app |
|
|||
167 |
|
||||
168 | def init_stack(self, config=None): |
|
|||
169 | if not config: |
|
|||
170 | config = pylons.test.pylonsapp.config |
|
|||
171 | url._push_object(URLGenerator(config['routes.map'], environ)) |
|
|||
172 | pylons.app_globals._push_object(config['pylons.app_globals']) |
|
|||
173 | pylons.config._push_object(config) |
|
|||
174 | pylons.tmpl_context._push_object(ContextObj()) |
|
|||
175 | # Initialize a translator for tests that utilize i18n |
|
|||
176 | translator = _get_translator(pylons.config.get('lang')) |
|
|||
177 | pylons.translator._push_object(translator) |
|
|||
178 | h = NullHandler() |
|
|||
179 | logging.getLogger("kallithea").addHandler(h) |
|
|||
180 |
|
||||
181 | def remove_all_notifications(self): |
|
|||
182 | # query().delete() does not (by default) trigger cascades |
|
|||
183 | # ( http://docs.sqlalchemy.org/en/rel_0_7/orm/collections.html#passive-deletes ) |
|
|||
184 | # so delete the UserNotification first to ensure referential integrity. |
|
|||
185 | UserNotification.query().delete() |
|
|||
186 |
|
||||
187 | Notification.query().delete() |
|
|||
188 | Session().commit() |
|
|||
189 |
|
||||
190 | def log_user(self, username=TEST_USER_ADMIN_LOGIN, |
|
|||
191 | password=TEST_USER_ADMIN_PASS): |
|
|||
192 | self._logged_username = username |
|
|||
193 | response = self.app.post(url(controller='login', action='index'), |
|
|||
194 | {'username': username, |
|
|||
195 | 'password': password}) |
|
|||
196 |
|
||||
197 | if 'Invalid username or password' in response.body: |
|
|||
198 | pytest.fail('could not login using %s %s' % (username, password)) |
|
|||
199 |
|
||||
200 | assert response.status == '302 Found' |
|
|||
201 | self.assert_authenticated_user(response, username) |
|
|||
202 |
|
||||
203 | response = response.follow() |
|
|||
204 | return response.session['authuser'] |
|
|||
205 |
|
||||
206 | def _get_logged_user(self): |
|
|||
207 | return User.get_by_username(self._logged_username) |
|
|||
208 |
|
||||
209 | def assert_authenticated_user(self, response, expected_username): |
|
|||
210 | cookie = response.session.get('authuser') |
|
|||
211 | user = cookie and cookie.get('user_id') |
|
|||
212 | user = user and User.get(user) |
|
|||
213 | user = user and user.username |
|
|||
214 | assert user == expected_username |
|
|||
215 |
|
||||
216 | def authentication_token(self): |
|
|||
217 | return self.app.get(url('authentication_token')).body |
|
|||
218 |
|
||||
219 | def checkSessionFlash(self, response, msg=None, skip=0, _matcher=lambda msg, m: msg in m): |
|
|||
220 | if 'flash' not in response.session: |
|
|||
221 | pytest.fail(safe_str(u'msg `%s` not found - session has no flash:\n%s' % (msg, response))) |
|
|||
222 | try: |
|
|||
223 | level, m = response.session['flash'][-1 - skip] |
|
|||
224 | if _matcher(msg, m): |
|
|||
225 | return |
|
|||
226 | except IndexError: |
|
|||
227 | pass |
|
|||
228 | pytest.fail(safe_str(u'msg `%s` not found in session flash (skipping %s): %s' % |
|
|||
229 | (msg, skip, |
|
|||
230 | ', '.join('`%s`' % m for level, m in response.session['flash'])))) |
|
|||
231 |
|
||||
232 | def checkSessionFlashRegex(self, response, regex, skip=0): |
|
|||
233 | self.checkSessionFlash(response, regex, skip=skip, _matcher=re.search) |
|
@@ -20,7 +20,7 b' import os' | |||||
20 | import random |
|
20 | import random | |
21 | import mock |
|
21 | import mock | |
22 |
|
22 | |||
23 | from kallithea.tests import * |
|
23 | from kallithea.tests.base import * | |
24 | from kallithea.tests.fixture import Fixture |
|
24 | from kallithea.tests.fixture import Fixture | |
25 | from kallithea.lib.compat import json |
|
25 | from kallithea.lib.compat import json | |
26 | from kallithea.lib.auth import AuthUser |
|
26 | from kallithea.lib.auth import AuthUser |
@@ -12,7 +12,7 b'' | |||||
12 | # You should have received a copy of the GNU General Public License |
|
12 | # You should have received a copy of the GNU General Public License | |
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 |
|
14 | |||
15 | from kallithea.tests import TestController, GIT_REPO |
|
15 | from kallithea.tests.base import TestController, GIT_REPO | |
16 | from kallithea.tests.api.api_base import _BaseTestApi |
|
16 | from kallithea.tests.api.api_base import _BaseTestApi | |
17 |
|
17 | |||
18 |
|
18 |
@@ -12,7 +12,7 b'' | |||||
12 | # You should have received a copy of the GNU General Public License |
|
12 | # You should have received a copy of the GNU General Public License | |
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 |
|
14 | |||
15 | from kallithea.tests import TestController, HG_REPO |
|
15 | from kallithea.tests.base import TestController, HG_REPO | |
16 | from kallithea.tests.api.api_base import _BaseTestApi |
|
16 | from kallithea.tests.api.api_base import _BaseTestApi | |
17 |
|
17 | |||
18 |
|
18 |
@@ -12,38 +12,26 b'' | |||||
12 | # You should have received a copy of the GNU General Public License |
|
12 | # You should have received a copy of the GNU General Public License | |
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 |
|
14 | |||
15 | """ |
|
15 | import datetime | |
16 | Kallithea test package |
|
16 | import logging | |
17 |
|
||||
18 | Refer to docs/contributing.rst for details on running the test suite. |
|
|||
19 | """ |
|
|||
20 | import os |
|
17 | import os | |
|
18 | import pytest | |||
21 | import re |
|
19 | import re | |
|
20 | import tempfile | |||
22 | import time |
|
21 | import time | |
23 | import logging |
|
|||
24 | import datetime |
|
|||
25 | import hashlib |
|
|||
26 | import tempfile |
|
|||
27 |
|
||||
28 | from tempfile import _RandomNameSequence |
|
|||
29 |
|
22 | |||
30 | import pylons |
|
23 | import pylons | |
31 | import pylons.test |
|
|||
32 | from pylons import config, url |
|
24 | from pylons import config, url | |
33 | from pylons.i18n.translation import _get_translator |
|
25 | from pylons.i18n.translation import _get_translator | |
34 | from pylons.util import ContextObj |
|
26 | from pylons.util import ContextObj | |
35 |
|
||||
36 | from routes.util import URLGenerator |
|
27 | from routes.util import URLGenerator | |
37 | from webtest import TestApp |
|
28 | from webtest import TestApp | |
38 | import pytest |
|
|||
39 |
|
29 | |||
40 | from kallithea.lib.compat import unittest |
|
|||
41 | from kallithea import is_windows |
|
30 | from kallithea import is_windows | |
42 | from kallithea.model.db import Notification, User, UserNotification |
|
31 | from kallithea.model.db import Notification, User, UserNotification | |
43 | from kallithea.model.meta import Session |
|
32 | from kallithea.model.meta import Session | |
44 | from kallithea.lib.utils2 import safe_str |
|
33 | from kallithea.lib.utils2 import safe_str | |
45 |
|
34 | |||
46 |
|
||||
47 | os.environ['TZ'] = 'UTC' |
|
35 | os.environ['TZ'] = 'UTC' | |
48 | if not is_windows: |
|
36 | if not is_windows: | |
49 | time.tzset() |
|
37 | time.tzset() | |
@@ -73,7 +61,7 b' environ = {}' | |||||
73 |
|
61 | |||
74 | #SOME GLOBALS FOR TESTS |
|
62 | #SOME GLOBALS FOR TESTS | |
75 |
|
63 | |||
76 | TESTS_TMP_PATH = os.path.join(tempfile.gettempdir(), 'rc_test_%s' % _RandomNameSequence().next()) |
|
64 | TESTS_TMP_PATH = os.path.join(tempfile.gettempdir(), 'rc_test_%s' % tempfile._RandomNameSequence().next()) | |
77 | TEST_USER_ADMIN_LOGIN = 'test_admin' |
|
65 | TEST_USER_ADMIN_LOGIN = 'test_admin' | |
78 | TEST_USER_ADMIN_PASS = 'test12' |
|
66 | TEST_USER_ADMIN_PASS = 'test12' | |
79 | TEST_USER_ADMIN_EMAIL = 'test_admin@example.com' |
|
67 | TEST_USER_ADMIN_EMAIL = 'test_admin@example.com' | |
@@ -231,3 +219,4 b' class TestController(object):' | |||||
231 |
|
219 | |||
232 | def checkSessionFlashRegex(self, response, regex, skip=0): |
|
220 | def checkSessionFlashRegex(self, response, regex, skip=0): | |
233 | self.checkSessionFlash(response, regex, skip=skip, _matcher=re.search) |
|
221 | self.checkSessionFlash(response, regex, skip=skip, _matcher=re.search) | |
|
222 |
@@ -10,7 +10,7 b' import pytest' | |||||
10 | from kallithea.model.user import UserModel |
|
10 | from kallithea.model.user import UserModel | |
11 | from kallithea.model.meta import Session |
|
11 | from kallithea.model.meta import Session | |
12 | from kallithea.model.db import Setting, User, UserIpMap |
|
12 | from kallithea.model.db import Setting, User, UserIpMap | |
13 | from kallithea.tests import invalidate_all_caches, TEST_USER_REGULAR_LOGIN |
|
13 | from kallithea.tests.base import invalidate_all_caches, TEST_USER_REGULAR_LOGIN | |
14 |
|
14 | |||
15 |
|
15 | |||
16 | def pytest_configure(): |
|
16 | def pytest_configure(): |
@@ -17,7 +17,7 b' Helpers for fixture generation' | |||||
17 | """ |
|
17 | """ | |
18 | import os |
|
18 | import os | |
19 | import time |
|
19 | import time | |
20 | from kallithea.tests import * |
|
20 | from kallithea.tests.base import * | |
21 | from kallithea.model.db import Repository, User, RepoGroup, UserGroup, Gist |
|
21 | from kallithea.model.db import Repository, User, RepoGroup, UserGroup, Gist | |
22 | from kallithea.model.meta import Session |
|
22 | from kallithea.model.meta import Session | |
23 | from kallithea.model.repo import RepoModel |
|
23 | from kallithea.model.repo import RepoModel |
@@ -1,7 +1,7 b'' | |||||
1 | import os |
|
1 | import os | |
2 | import csv |
|
2 | import csv | |
3 | import datetime |
|
3 | import datetime | |
4 | from kallithea.tests import * |
|
4 | from kallithea.tests.base import * | |
5 | from kallithea.model.db import UserLog |
|
5 | from kallithea.model.db import UserLog | |
6 | from kallithea.model.meta import Session |
|
6 | from kallithea.model.meta import Session | |
7 | from kallithea.lib.utils2 import safe_unicode |
|
7 | from kallithea.lib.utils2 import safe_unicode |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.model.db import Setting |
|
2 | from kallithea.model.db import Setting | |
3 |
|
3 | |||
4 |
|
4 |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.model.db import Setting |
|
2 | from kallithea.model.db import Setting | |
3 |
|
3 | |||
4 |
|
4 |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.model.gist import GistModel |
|
2 | from kallithea.model.gist import GistModel | |
3 | from kallithea.model.meta import Session |
|
3 | from kallithea.model.meta import Session | |
4 | from kallithea.model.db import User, Gist |
|
4 | from kallithea.model.db import User, Gist |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.model.db import User |
|
2 | from kallithea.model.db import User | |
3 |
|
3 | |||
4 | from kallithea.model.user import UserModel |
|
4 | from kallithea.model.user import UserModel |
@@ -3,7 +3,7 b' import time' | |||||
3 | from kallithea.model.db import User, UserIpMap |
|
3 | from kallithea.model.db import User, UserIpMap | |
4 | from kallithea.model.user import UserModel |
|
4 | from kallithea.model.user import UserModel | |
5 | from kallithea.model.meta import Session |
|
5 | from kallithea.model.meta import Session | |
6 | from kallithea.tests import * |
|
6 | from kallithea.tests.base import * | |
7 |
|
7 | |||
8 | class TestAdminPermissionsController(TestController): |
|
8 | class TestAdminPermissionsController(TestController): | |
9 |
|
9 |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 |
|
2 | |||
3 | class TestRepoGroupsController(TestController): |
|
3 | class TestRepoGroupsController(TestController): | |
4 | pass |
|
4 | pass |
@@ -11,7 +11,7 b' from kallithea.lib.utils2 import safe_st' | |||||
11 | from kallithea.model.db import Repository, RepoGroup, UserRepoToPerm, User, \ |
|
11 | from kallithea.model.db import Repository, RepoGroup, UserRepoToPerm, User, \ | |
12 | Permission, Ui |
|
12 | Permission, Ui | |
13 | from kallithea.model.user import UserModel |
|
13 | from kallithea.model.user import UserModel | |
14 | from kallithea.tests import * |
|
14 | from kallithea.tests.base import * | |
15 | from kallithea.model.repo_group import RepoGroupModel |
|
15 | from kallithea.model.repo_group import RepoGroupModel | |
16 | from kallithea.model.repo import RepoModel |
|
16 | from kallithea.model.repo import RepoModel | |
17 | from kallithea.model.meta import Session |
|
17 | from kallithea.model.meta import Session |
@@ -3,7 +3,7 b'' | |||||
3 | import tempfile |
|
3 | import tempfile | |
4 |
|
4 | |||
5 | from kallithea.model.db import Setting, Ui |
|
5 | from kallithea.model.db import Setting, Ui | |
6 | from kallithea.tests import * |
|
6 | from kallithea.tests.base import * | |
7 | from kallithea.tests.fixture import Fixture |
|
7 | from kallithea.tests.fixture import Fixture | |
8 |
|
8 | |||
9 | fixture = Fixture() |
|
9 | fixture = Fixture() |
@@ -1,5 +1,5 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | from kallithea.tests import * |
|
2 | from kallithea.tests.base import * | |
3 | from kallithea.model.db import UserGroup, UserGroupToPerm, Permission |
|
3 | from kallithea.model.db import UserGroup, UserGroupToPerm, Permission | |
4 | from kallithea.model.meta import Session |
|
4 | from kallithea.model.meta import Session | |
5 |
|
5 |
@@ -15,7 +15,7 b'' | |||||
15 | from sqlalchemy.orm.exc import NoResultFound, ObjectDeletedError |
|
15 | from sqlalchemy.orm.exc import NoResultFound, ObjectDeletedError | |
16 |
|
16 | |||
17 | import pytest |
|
17 | import pytest | |
18 | from kallithea.tests import * |
|
18 | from kallithea.tests.base import * | |
19 | from kallithea.tests.fixture import Fixture |
|
19 | from kallithea.tests.fixture import Fixture | |
20 | from kallithea.controllers.admin.users import UsersController |
|
20 | from kallithea.controllers.admin.users import UsersController | |
21 | from kallithea.model.db import User, Permission, UserIpMap, UserApiKeys |
|
21 | from kallithea.model.db import User, Permission, UserIpMap, UserApiKeys |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | class TestChangelogController(TestController): |
|
4 | class TestChangelogController(TestController): |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 |
|
2 | |||
3 | class TestChangesetController(TestController): |
|
3 | class TestChangesetController(TestController): | |
4 |
|
4 |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.model.db import ChangesetComment, Notification, \ |
|
2 | from kallithea.model.db import ChangesetComment, Notification, \ | |
3 | UserNotification |
|
3 | UserNotification | |
4 | from kallithea.model.meta import Session |
|
4 | from kallithea.model.meta import Session |
@@ -1,5 +1,5 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | from kallithea.tests import * |
|
2 | from kallithea.tests.base import * | |
3 | from kallithea.model.repo import RepoModel |
|
3 | from kallithea.model.repo import RepoModel | |
4 | from kallithea.model.meta import Session |
|
4 | from kallithea.model.meta import Session | |
5 | from kallithea.tests.fixture import Fixture |
|
5 | from kallithea.tests.fixture import Fixture |
@@ -1,5 +1,5 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | from kallithea.tests import * |
|
2 | from kallithea.tests.base import * | |
3 |
|
3 | |||
4 | class TestCompareController(TestController): |
|
4 | class TestCompareController(TestController): | |
5 |
|
5 |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 |
|
2 | |||
3 | class TestFeedController(TestController): |
|
3 | class TestFeedController(TestController): | |
4 |
|
4 |
@@ -2,7 +2,7 b'' | |||||
2 | import os |
|
2 | import os | |
3 | import posixpath |
|
3 | import posixpath | |
4 | import mimetypes |
|
4 | import mimetypes | |
5 | from kallithea.tests import * |
|
5 | from kallithea.tests.base import * | |
6 | from kallithea.model.db import Repository |
|
6 | from kallithea.model.db import Repository | |
7 | from kallithea.model.meta import Session |
|
7 | from kallithea.model.meta import Session | |
8 | from kallithea.tests.fixture import Fixture |
|
8 | from kallithea.tests.fixture import Fixture |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | class TestFollowersController(TestController): |
|
4 | class TestFollowersController(TestController): |
@@ -2,7 +2,7 b'' | |||||
2 |
|
2 | |||
3 | import unittest |
|
3 | import unittest | |
4 |
|
4 | |||
5 | from kallithea.tests import * |
|
5 | from kallithea.tests.base import * | |
6 | from kallithea.tests.fixture import Fixture |
|
6 | from kallithea.tests.fixture import Fixture | |
7 |
|
7 | |||
8 | from kallithea.model.db import Repository |
|
8 | from kallithea.model.db import Repository |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.tests.fixture import Fixture |
|
2 | from kallithea.tests.fixture import Fixture | |
3 | from kallithea.model.meta import Session |
|
3 | from kallithea.model.meta import Session | |
4 | from kallithea.model.db import Repository |
|
4 | from kallithea.model.db import Repository |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | import datetime |
|
2 | import datetime | |
3 |
|
3 | |||
4 |
|
4 |
@@ -5,7 +5,7 b' import urlparse' | |||||
5 |
|
5 | |||
6 | import mock |
|
6 | import mock | |
7 |
|
7 | |||
8 | from kallithea.tests import * |
|
8 | from kallithea.tests.base import * | |
9 | from kallithea.tests.fixture import Fixture |
|
9 | from kallithea.tests.fixture import Fixture | |
10 | from kallithea.lib.utils2 import generate_api_key |
|
10 | from kallithea.lib.utils2 import generate_api_key | |
11 | from kallithea.lib.auth import check_password |
|
11 | from kallithea.lib.auth import check_password |
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | from kallithea.model.db import User, UserFollowing, Repository, UserApiKeys |
|
3 | from kallithea.model.db import User, UserFollowing, Repository, UserApiKeys | |
4 | from kallithea.tests import * |
|
4 | from kallithea.tests.base import * | |
5 | from kallithea.tests.fixture import Fixture |
|
5 | from kallithea.tests.fixture import Fixture | |
6 | from kallithea.lib import helpers as h |
|
6 | from kallithea.lib import helpers as h | |
7 | from kallithea.model.user import UserModel |
|
7 | from kallithea.model.user import UserModel |
@@ -1,6 +1,6 b'' | |||||
1 | import re |
|
1 | import re | |
2 |
|
2 | |||
3 | from kallithea.tests import * |
|
3 | from kallithea.tests.base import * | |
4 | from kallithea.tests.fixture import Fixture |
|
4 | from kallithea.tests.fixture import Fixture | |
5 | from kallithea.model.meta import Session |
|
5 | from kallithea.model.meta import Session | |
6 |
|
6 |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | class TestRepoGroupsController(TestController): |
|
4 | class TestRepoGroupsController(TestController): |
@@ -1,6 +1,6 b'' | |||||
1 | import mock |
|
1 | import mock | |
2 | import os |
|
2 | import os | |
3 | from kallithea.tests import * |
|
3 | from kallithea.tests.base import * | |
4 |
|
4 | |||
5 |
|
5 | |||
6 | class TestSearchController(TestController): |
|
6 | class TestSearchController(TestController): |
@@ -12,7 +12,7 b'' | |||||
12 | # You should have received a copy of the GNU General Public License |
|
12 | # You should have received a copy of the GNU General Public License | |
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 |
|
14 | |||
15 | from kallithea.tests import * |
|
15 | from kallithea.tests.base import * | |
16 | from kallithea.tests.fixture import Fixture |
|
16 | from kallithea.tests.fixture import Fixture | |
17 | from kallithea.model.db import Repository |
|
17 | from kallithea.model.db import Repository | |
18 | from kallithea.model.repo import RepoModel |
|
18 | from kallithea.model.repo import RepoModel |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.tests.fixture import Fixture |
|
2 | from kallithea.tests.fixture import Fixture | |
3 |
|
3 | |||
4 | from kallithea.model.repo_group import RepoGroupModel |
|
4 | from kallithea.model.repo_group import RepoGroupModel |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.model.changeset_status import ChangesetStatusModel |
|
2 | from kallithea.model.changeset_status import ChangesetStatusModel | |
3 | from kallithea.model.db import ChangesetStatus as CS |
|
3 | from kallithea.model.db import ChangesetStatus as CS | |
4 |
|
4 |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.lib.diffs import DiffProcessor, NEW_FILENODE, DEL_FILENODE, \ |
|
2 | from kallithea.lib.diffs import DiffProcessor, NEW_FILENODE, DEL_FILENODE, \ | |
3 | MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE |
|
3 | MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE | |
4 | from kallithea.tests.fixture import Fixture |
|
4 | from kallithea.tests.fixture import Fixture |
@@ -4,7 +4,7 b' import re' | |||||
4 | import mock |
|
4 | import mock | |
5 | import routes.util |
|
5 | import routes.util | |
6 |
|
6 | |||
7 | from kallithea.tests import * |
|
7 | from kallithea.tests.base import * | |
8 | from kallithea.lib import helpers as h |
|
8 | from kallithea.lib import helpers as h | |
9 | from kallithea.model.db import User, Notification, UserNotification |
|
9 | from kallithea.model.db import User, Notification, UserNotification | |
10 | from kallithea.model.user import UserModel |
|
10 | from kallithea.model.user import UserModel |
@@ -1,4 +1,4 b'' | |||||
1 | from kallithea.tests import * |
|
1 | from kallithea.tests.base import * | |
2 | from kallithea.tests.fixture import Fixture |
|
2 | from kallithea.tests.fixture import Fixture | |
3 | from kallithea.model.repo_group import RepoGroupModel |
|
3 | from kallithea.model.repo_group import RepoGroupModel | |
4 | from kallithea.model.repo import RepoModel |
|
4 | from kallithea.model.repo import RepoModel |
@@ -2,7 +2,7 b' import os' | |||||
2 | import pytest |
|
2 | import pytest | |
3 | from sqlalchemy.exc import IntegrityError |
|
3 | from sqlalchemy.exc import IntegrityError | |
4 |
|
4 | |||
5 | from kallithea.tests import * |
|
5 | from kallithea.tests.base import * | |
6 | from kallithea.tests.fixture import Fixture |
|
6 | from kallithea.tests.fixture import Fixture | |
7 |
|
7 | |||
8 | from kallithea.model.repo_group import RepoGroupModel |
|
8 | from kallithea.model.repo_group import RepoGroupModel |
@@ -1,5 +1,5 b'' | |||||
1 | import pytest |
|
1 | import pytest | |
2 | from kallithea.tests import * |
|
2 | from kallithea.tests.base import * | |
3 |
|
3 | |||
4 | from kallithea.model.meta import Session |
|
4 | from kallithea.model.meta import Session | |
5 | from kallithea.tests.fixture import Fixture |
|
5 | from kallithea.tests.fixture import Fixture |
@@ -1,6 +1,6 b'' | |||||
1 | from kallithea.model.db import User, UserGroup |
|
1 | from kallithea.model.db import User, UserGroup | |
2 |
|
2 | |||
3 | from kallithea.tests import * |
|
3 | from kallithea.tests.base import * | |
4 | from kallithea.tests.fixture import Fixture |
|
4 | from kallithea.tests.fixture import Fixture | |
5 |
|
5 | |||
6 | from kallithea.model.user_group import UserGroupModel |
|
6 | from kallithea.model.user_group import UserGroupModel |
@@ -1,5 +1,5 b'' | |||||
1 | import pytest |
|
1 | import pytest | |
2 | from kallithea.tests import * |
|
2 | from kallithea.tests.base import * | |
3 |
|
3 | |||
4 | from kallithea.model.db import User, UserGroup, UserGroupMember, UserEmailMap, \ |
|
4 | from kallithea.model.db import User, UserGroup, UserGroupMember, UserEmailMap, \ | |
5 | Permission |
|
5 | Permission |
@@ -40,7 +40,7 b' import time' | |||||
40 | from tempfile import _RandomNameSequence |
|
40 | from tempfile import _RandomNameSequence | |
41 | from subprocess import Popen, PIPE |
|
41 | from subprocess import Popen, PIPE | |
42 |
|
42 | |||
43 | from kallithea.tests import * |
|
43 | from kallithea.tests.base import * | |
44 | from kallithea.tests.fixture import Fixture |
|
44 | from kallithea.tests.fixture import Fixture | |
45 | from kallithea.model.db import User, Repository, UserIpMap, CacheInvalidation |
|
45 | from kallithea.model.db import User, Repository, UserIpMap, CacheInvalidation | |
46 | from kallithea.model.meta import Session |
|
46 | from kallithea.model.meta import Session |
@@ -28,7 +28,7 b' Original author and date, and relevant c' | |||||
28 | import datetime |
|
28 | import datetime | |
29 | import hashlib |
|
29 | import hashlib | |
30 | import mock |
|
30 | import mock | |
31 | from kallithea.tests import * |
|
31 | from kallithea.tests.base import * | |
32 | from kallithea.lib.utils2 import AttributeDict |
|
32 | from kallithea.lib.utils2 import AttributeDict | |
33 | from kallithea.model.db import Repository |
|
33 | from kallithea.model.db import Repository | |
34 |
|
34 |
@@ -1,7 +1,7 b'' | |||||
1 | import mock |
|
1 | import mock | |
2 |
|
2 | |||
3 | import kallithea |
|
3 | import kallithea | |
4 | from kallithea.tests import * |
|
4 | from kallithea.tests.base import * | |
5 | from kallithea.model.db import User |
|
5 | from kallithea.model.db import User | |
6 |
|
6 | |||
7 | class smtplib_mock(object): |
|
7 | class smtplib_mock(object): |
@@ -3,7 +3,7 b' import formencode' | |||||
3 | import pytest |
|
3 | import pytest | |
4 | import tempfile |
|
4 | import tempfile | |
5 |
|
5 | |||
6 | from kallithea.tests import * |
|
6 | from kallithea.tests.base import * | |
7 |
|
7 | |||
8 | from kallithea.model import validators as v |
|
8 | from kallithea.model import validators as v | |
9 | from kallithea.model.user_group import UserGroupModel |
|
9 | from kallithea.model.user_group import UserGroupModel |
@@ -44,7 +44,7 b' from kallithea.model import meta' | |||||
44 | from kallithea.model.db import User, Repository, Ui |
|
44 | from kallithea.model.db import User, Repository, Ui | |
45 | from kallithea.lib.auth import get_crypt_password |
|
45 | from kallithea.lib.auth import get_crypt_password | |
46 |
|
46 | |||
47 | from kallithea.tests import HG_REPO |
|
47 | from kallithea.tests.base import HG_REPO | |
48 | from kallithea.config.environment import load_environment |
|
48 | from kallithea.config.environment import load_environment | |
49 |
|
49 | |||
50 | rel_path = dirname(dirname(dirname(dirname(os.path.abspath(__file__))))) |
|
50 | rel_path = dirname(dirname(dirname(dirname(os.path.abspath(__file__))))) |
@@ -23,7 +23,7 b' from kallithea.lib.vcs.utils.compat impo' | |||||
23 | from kallithea.tests.vcs.conf import * |
|
23 | from kallithea.tests.vcs.conf import * | |
24 | from kallithea.tests.vcs.utils import SCMFetcher |
|
24 | from kallithea.tests.vcs.utils import SCMFetcher | |
25 |
|
25 | |||
26 | from kallithea.tests import * |
|
26 | from kallithea.tests.base import * | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | def setup_package(): |
|
29 | def setup_package(): |
@@ -84,4 +84,4 b" shutil.copy(os.path.join(THIS, 'aconfig'" | |||||
84 | TEST_USER_CONFIG_FILE = _dest |
|
84 | TEST_USER_CONFIG_FILE = _dest | |
85 |
|
85 | |||
86 | #overide default configurations with kallithea ones |
|
86 | #overide default configurations with kallithea ones | |
87 | from kallithea.tests import * |
|
87 | from kallithea.tests.base import * |
General Comments 0
You need to be logged in to leave comments.
Login now