##// END OF EJS Templates
merged with beta
marcink -
r3181:efe23d6c merge rhodecode-0.0.1.5.2 default
parent child Browse files
Show More
@@ -1,461 +1,470 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.tests.test_scm_operations
3 rhodecode.tests.test_scm_operations
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Test suite for making push/pull operations.
6 Test suite for making push/pull operations.
7 Run using::
7 Run using::
8
8
9 RC_WHOOSH_TEST_DISABLE=1 RC_NO_TMP_PATH=1 nosetests rhodecode/tests/scripts/test_vcs_operations.py
9 RC_WHOOSH_TEST_DISABLE=1 RC_NO_TMP_PATH=1 nosetests rhodecode/tests/scripts/test_vcs_operations.py
10
10
11 :created_on: Dec 30, 2010
11 :created_on: Dec 30, 2010
12 :author: marcink
12 :author: marcink
13 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
13 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
14 :license: GPLv3, see COPYING for more details.
14 :license: GPLv3, see COPYING for more details.
15 """
15 """
16 # This program is free software: you can redistribute it and/or modify
16 # This program is free software: you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation, either version 3 of the License, or
18 # the Free Software Foundation, either version 3 of the License, or
19 # (at your option) any later version.
19 # (at your option) any later version.
20 #
20 #
21 # This program is distributed in the hope that it will be useful,
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
24 # GNU General Public License for more details.
25 #
25 #
26 # You should have received a copy of the GNU General Public License
26 # You should have received a copy of the GNU General Public License
27 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 # along with this program. If not, see <http://www.gnu.org/licenses/>.
28
28
29 import os
29 import os
30 import tempfile
30 import tempfile
31 import unittest
31 import unittest
32 import time
32 from os.path import join as jn
33 from os.path import join as jn
33 from os.path import dirname as dn
34 from os.path import dirname as dn
34
35
35 from tempfile import _RandomNameSequence
36 from tempfile import _RandomNameSequence
36 from subprocess import Popen, PIPE
37 from subprocess import Popen, PIPE
37
38
38 from rhodecode.tests import *
39 from rhodecode.tests import *
39 from rhodecode.model.db import User, Repository, UserLog
40 from rhodecode.model.db import User, Repository, UserLog, UserIpMap
40 from rhodecode.model.meta import Session
41 from rhodecode.model.meta import Session
41 from rhodecode.model.repo import RepoModel
42 from rhodecode.model.repo import RepoModel
42 from rhodecode.model.user import UserModel
43 from rhodecode.model.user import UserModel
43
44
44 DEBUG = True
45 DEBUG = True
45 HOST = '127.0.0.1:5000' # test host
46 HOST = '127.0.0.1:5000' # test host
46
47
47
48
48 class Command(object):
49 class Command(object):
49
50
50 def __init__(self, cwd):
51 def __init__(self, cwd):
51 self.cwd = cwd
52 self.cwd = cwd
52
53
53 def execute(self, cmd, *args):
54 def execute(self, cmd, *args):
54 """
55 """
55 Runs command on the system with given ``args``.
56 Runs command on the system with given ``args``.
56 """
57 """
57
58
58 command = cmd + ' ' + ' '.join(args)
59 command = cmd + ' ' + ' '.join(args)
59 if DEBUG:
60 if DEBUG:
60 print '*** CMD %s ***' % command
61 print '*** CMD %s ***' % command
61 p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd)
62 p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd)
62 stdout, stderr = p.communicate()
63 stdout, stderr = p.communicate()
63 if DEBUG:
64 if DEBUG:
64 print stdout, stderr
65 print stdout, stderr
65 return stdout, stderr
66 return stdout, stderr
66
67
67
68
68 def _get_tmp_dir():
69 def _get_tmp_dir():
69 return tempfile.mkdtemp(prefix='rc_integration_test')
70 return tempfile.mkdtemp(prefix='rc_integration_test')
70
71
71
72
72 def _construct_url(repo, dest=None, **kwargs):
73 def _construct_url(repo, dest=None, **kwargs):
73 if dest is None:
74 if dest is None:
74 #make temp clone
75 #make temp clone
75 dest = _get_tmp_dir()
76 dest = _get_tmp_dir()
76 params = {
77 params = {
77 'user': TEST_USER_ADMIN_LOGIN,
78 'user': TEST_USER_ADMIN_LOGIN,
78 'passwd': TEST_USER_ADMIN_PASS,
79 'passwd': TEST_USER_ADMIN_PASS,
79 'host': HOST,
80 'host': HOST,
80 'cloned_repo': repo,
81 'cloned_repo': repo,
81 'dest': dest
82 'dest': dest
82 }
83 }
83 params.update(**kwargs)
84 params.update(**kwargs)
84 if params['user'] and params['passwd']:
85 if params['user'] and params['passwd']:
85 _url = 'http://%(user)s:%(passwd)s@%(host)s/%(cloned_repo)s %(dest)s' % params
86 _url = 'http://%(user)s:%(passwd)s@%(host)s/%(cloned_repo)s %(dest)s' % params
86 else:
87 else:
87 _url = 'http://(host)s/%(cloned_repo)s %(dest)s' % params
88 _url = 'http://(host)s/%(cloned_repo)s %(dest)s' % params
88 return _url
89 return _url
89
90
90
91
91 def _add_files_and_push(vcs, DEST, **kwargs):
92 def _add_files_and_push(vcs, DEST, **kwargs):
92 """
93 """
93 Generate some files, add it to DEST repo and push back
94 Generate some files, add it to DEST repo and push back
94 vcs is git or hg and defines what VCS we want to make those files for
95 vcs is git or hg and defines what VCS we want to make those files for
95
96
96 :param vcs:
97 :param vcs:
97 :param DEST:
98 :param DEST:
98 """
99 """
99 # commit some stuff into this repo
100 # commit some stuff into this repo
100 cwd = path = jn(DEST)
101 cwd = path = jn(DEST)
101 #added_file = jn(path, '%ssetupΔ…ΕΌΕΊΔ‡.py' % _RandomNameSequence().next())
102 #added_file = jn(path, '%ssetupΔ…ΕΌΕΊΔ‡.py' % _RandomNameSequence().next())
102 added_file = jn(path, '%ssetup.py' % _RandomNameSequence().next())
103 added_file = jn(path, '%ssetup.py' % _RandomNameSequence().next())
103 Command(cwd).execute('touch %s' % added_file)
104 Command(cwd).execute('touch %s' % added_file)
104 Command(cwd).execute('%s add %s' % (vcs, added_file))
105 Command(cwd).execute('%s add %s' % (vcs, added_file))
105
106
106 for i in xrange(3):
107 for i in xrange(3):
107 cmd = """echo 'added_line%s' >> %s""" % (i, added_file)
108 cmd = """echo 'added_line%s' >> %s""" % (i, added_file)
108 Command(cwd).execute(cmd)
109 Command(cwd).execute(cmd)
109 if vcs == 'hg':
110 if vcs == 'hg':
110 cmd = """hg commit -m 'commited new %s' -u '%s' %s """ % (
111 cmd = """hg commit -m 'commited new %s' -u '%s' %s """ % (
111 i, 'Marcin KuΕΊminski <marcin@python-blog.com>', added_file
112 i, 'Marcin KuΕΊminski <marcin@python-blog.com>', added_file
112 )
113 )
113 elif vcs == 'git':
114 elif vcs == 'git':
114 cmd = """git ci -m 'commited new %s' --author '%s' %s """ % (
115 cmd = """git ci -m 'commited new %s' --author '%s' %s """ % (
115 i, 'Marcin KuΕΊminski <marcin@python-blog.com>', added_file
116 i, 'Marcin KuΕΊminski <marcin@python-blog.com>', added_file
116 )
117 )
117 Command(cwd).execute(cmd)
118 Command(cwd).execute(cmd)
118 # PUSH it back
119 # PUSH it back
119 if vcs == 'hg':
120 if vcs == 'hg':
120 _REPO = HG_REPO
121 _REPO = HG_REPO
121 elif vcs == 'git':
122 elif vcs == 'git':
122 _REPO = GIT_REPO
123 _REPO = GIT_REPO
123
124
124 kwargs['dest'] = ''
125 kwargs['dest'] = ''
125 clone_url = _construct_url(_REPO, **kwargs)
126 clone_url = _construct_url(_REPO, **kwargs)
126 if 'clone_url' in kwargs:
127 if 'clone_url' in kwargs:
127 clone_url = kwargs['clone_url']
128 clone_url = kwargs['clone_url']
128 if vcs == 'hg':
129 if vcs == 'hg':
129 stdout, stderr = Command(cwd).execute('hg push --verbose', clone_url)
130 stdout, stderr = Command(cwd).execute('hg push --verbose', clone_url)
130 elif vcs == 'git':
131 elif vcs == 'git':
131 stdout, stderr = Command(cwd).execute('git push', clone_url + " master")
132 stdout, stderr = Command(cwd).execute('git push', clone_url + " master")
132
133
133 return stdout, stderr
134 return stdout, stderr
134
135
135
136
136 def set_anonymous_access(enable=True):
137 def set_anonymous_access(enable=True):
137 user = User.get_by_username(User.DEFAULT_USER)
138 user = User.get_by_username(User.DEFAULT_USER)
138 user.active = enable
139 user.active = enable
139 Session().add(user)
140 Session().add(user)
140 Session().commit()
141 Session().commit()
141 print '\tanonymous access is now:', enable
142 print '\tanonymous access is now:', enable
142 if enable != User.get_by_username(User.DEFAULT_USER).active:
143 if enable != User.get_by_username(User.DEFAULT_USER).active:
143 raise Exception('Cannot set anonymous access')
144 raise Exception('Cannot set anonymous access')
144
145
145
146
146 #==============================================================================
147 #==============================================================================
147 # TESTS
148 # TESTS
148 #==============================================================================
149 #==============================================================================
149
150
150 class TestVCSOperations(unittest.TestCase):
151 class TestVCSOperations(unittest.TestCase):
151
152
152 @classmethod
153 @classmethod
153 def setup_class(cls):
154 def setup_class(cls):
154 #DISABLE ANONYMOUS ACCESS
155 #DISABLE ANONYMOUS ACCESS
155 set_anonymous_access(False)
156 set_anonymous_access(False)
156
157
157 def setUp(self):
158 def setUp(self):
158 r = Repository.get_by_repo_name(GIT_REPO)
159 r = Repository.get_by_repo_name(GIT_REPO)
159 Repository.unlock(r)
160 Repository.unlock(r)
160 r.enable_locking = False
161 r.enable_locking = False
161 Session().add(r)
162 Session().add(r)
162 Session().commit()
163 Session().commit()
163
164
164 r = Repository.get_by_repo_name(HG_REPO)
165 r = Repository.get_by_repo_name(HG_REPO)
165 Repository.unlock(r)
166 Repository.unlock(r)
166 r.enable_locking = False
167 r.enable_locking = False
167 Session().add(r)
168 Session().add(r)
168 Session().commit()
169 Session().commit()
169
170
170 def test_clone_hg_repo_by_admin(self):
171 def test_clone_hg_repo_by_admin(self):
171 clone_url = _construct_url(HG_REPO)
172 clone_url = _construct_url(HG_REPO)
172 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
173 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
173
174
174 assert 'requesting all changes' in stdout
175 assert 'requesting all changes' in stdout
175 assert 'adding changesets' in stdout
176 assert 'adding changesets' in stdout
176 assert 'adding manifests' in stdout
177 assert 'adding manifests' in stdout
177 assert 'adding file changes' in stdout
178 assert 'adding file changes' in stdout
178
179
179 assert stderr == ''
180 assert stderr == ''
180
181
181 def test_clone_git_repo_by_admin(self):
182 def test_clone_git_repo_by_admin(self):
182 clone_url = _construct_url(GIT_REPO)
183 clone_url = _construct_url(GIT_REPO)
183 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
184 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
184
185
185 assert 'Cloning into' in stdout
186 assert 'Cloning into' in stdout
186 assert stderr == ''
187 assert stderr == ''
187
188
188 def test_clone_wrong_credentials_hg(self):
189 def test_clone_wrong_credentials_hg(self):
189 clone_url = _construct_url(HG_REPO, passwd='bad!')
190 clone_url = _construct_url(HG_REPO, passwd='bad!')
190 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
191 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
191 assert 'abort: authorization failed' in stderr
192 assert 'abort: authorization failed' in stderr
192
193
193 def test_clone_wrong_credentials_git(self):
194 def test_clone_wrong_credentials_git(self):
194 clone_url = _construct_url(GIT_REPO, passwd='bad!')
195 clone_url = _construct_url(GIT_REPO, passwd='bad!')
195 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
196 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
196 assert 'fatal: Authentication failed' in stderr
197 assert 'fatal: Authentication failed' in stderr
197
198
198 def test_clone_git_dir_as_hg(self):
199 def test_clone_git_dir_as_hg(self):
199 clone_url = _construct_url(GIT_REPO)
200 clone_url = _construct_url(GIT_REPO)
200 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
201 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
201 assert 'HTTP Error 404: Not Found' in stderr
202 assert 'HTTP Error 404: Not Found' in stderr
202
203
203 def test_clone_hg_repo_as_git(self):
204 def test_clone_hg_repo_as_git(self):
204 clone_url = _construct_url(HG_REPO)
205 clone_url = _construct_url(HG_REPO)
205 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
206 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
206 assert 'not found:' in stderr
207 assert 'not found:' in stderr
207
208
208 def test_clone_non_existing_path_hg(self):
209 def test_clone_non_existing_path_hg(self):
209 clone_url = _construct_url('trololo')
210 clone_url = _construct_url('trololo')
210 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
211 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
211 assert 'HTTP Error 404: Not Found' in stderr
212 assert 'HTTP Error 404: Not Found' in stderr
212
213
213 def test_clone_non_existing_path_git(self):
214 def test_clone_non_existing_path_git(self):
214 clone_url = _construct_url('trololo')
215 clone_url = _construct_url('trololo')
215 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
216 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
216 assert 'not found:' in stderr
217 assert 'not found:' in stderr
217
218
218 def test_push_new_file_hg(self):
219 def test_push_new_file_hg(self):
219 DEST = _get_tmp_dir()
220 DEST = _get_tmp_dir()
220 clone_url = _construct_url(HG_REPO, dest=DEST)
221 clone_url = _construct_url(HG_REPO, dest=DEST)
221 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
222 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
222
223
223 stdout, stderr = _add_files_and_push('hg', DEST)
224 stdout, stderr = _add_files_and_push('hg', DEST)
224
225
225 assert 'pushing to' in stdout
226 assert 'pushing to' in stdout
226 assert 'Repository size' in stdout
227 assert 'Repository size' in stdout
227 assert 'Last revision is now' in stdout
228 assert 'Last revision is now' in stdout
228
229
229 def test_push_new_file_git(self):
230 def test_push_new_file_git(self):
230 DEST = _get_tmp_dir()
231 DEST = _get_tmp_dir()
231 clone_url = _construct_url(GIT_REPO, dest=DEST)
232 clone_url = _construct_url(GIT_REPO, dest=DEST)
232 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
233 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
233
234
234 # commit some stuff into this repo
235 # commit some stuff into this repo
235 stdout, stderr = _add_files_and_push('git', DEST)
236 stdout, stderr = _add_files_and_push('git', DEST)
236
237
237 #WTF git stderr ?!
238 #WTF git stderr ?!
238 assert 'master -> master' in stderr
239 assert 'master -> master' in stderr
239
240
240 def test_push_wrong_credentials_hg(self):
241 def test_push_wrong_credentials_hg(self):
241 DEST = _get_tmp_dir()
242 DEST = _get_tmp_dir()
242 clone_url = _construct_url(HG_REPO, dest=DEST)
243 clone_url = _construct_url(HG_REPO, dest=DEST)
243 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
244 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
244
245
245 stdout, stderr = _add_files_and_push('hg', DEST, user='bad',
246 stdout, stderr = _add_files_and_push('hg', DEST, user='bad',
246 passwd='name')
247 passwd='name')
247
248
248 assert 'abort: authorization failed' in stderr
249 assert 'abort: authorization failed' in stderr
249
250
250 def test_push_wrong_credentials_git(self):
251 def test_push_wrong_credentials_git(self):
251 DEST = _get_tmp_dir()
252 DEST = _get_tmp_dir()
252 clone_url = _construct_url(GIT_REPO, dest=DEST)
253 clone_url = _construct_url(GIT_REPO, dest=DEST)
253 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
254 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
254
255
255 stdout, stderr = _add_files_and_push('git', DEST, user='bad',
256 stdout, stderr = _add_files_and_push('git', DEST, user='bad',
256 passwd='name')
257 passwd='name')
257
258
258 assert 'fatal: Authentication failed' in stderr
259 assert 'fatal: Authentication failed' in stderr
259
260
260 def test_push_back_to_wrong_url_hg(self):
261 def test_push_back_to_wrong_url_hg(self):
261 DEST = _get_tmp_dir()
262 DEST = _get_tmp_dir()
262 clone_url = _construct_url(HG_REPO, dest=DEST)
263 clone_url = _construct_url(HG_REPO, dest=DEST)
263 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
264 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
264
265
265 stdout, stderr = _add_files_and_push('hg', DEST,
266 stdout, stderr = _add_files_and_push('hg', DEST,
266 clone_url='http://127.0.0.1:5000/tmp',)
267 clone_url='http://127.0.0.1:5000/tmp',)
267
268
268 assert 'HTTP Error 404: Not Found' in stderr
269 assert 'HTTP Error 404: Not Found' in stderr
269
270
270 def test_push_back_to_wrong_url_git(self):
271 def test_push_back_to_wrong_url_git(self):
271 DEST = _get_tmp_dir()
272 DEST = _get_tmp_dir()
272 clone_url = _construct_url(GIT_REPO, dest=DEST)
273 clone_url = _construct_url(GIT_REPO, dest=DEST)
273 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
274 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
274
275
275 stdout, stderr = _add_files_and_push('git', DEST,
276 stdout, stderr = _add_files_and_push('git', DEST,
276 clone_url='http://127.0.0.1:5000/tmp',)
277 clone_url='http://127.0.0.1:5000/tmp',)
277
278
278 assert 'not found:' in stderr
279 assert 'not found:' in stderr
279
280
280 def test_clone_and_create_lock_hg(self):
281 def test_clone_and_create_lock_hg(self):
281 # enable locking
282 # enable locking
282 r = Repository.get_by_repo_name(HG_REPO)
283 r = Repository.get_by_repo_name(HG_REPO)
283 r.enable_locking = True
284 r.enable_locking = True
284 Session().add(r)
285 Session().add(r)
285 Session().commit()
286 Session().commit()
286 # clone
287 # clone
287 clone_url = _construct_url(HG_REPO)
288 clone_url = _construct_url(HG_REPO)
288 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
289 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
289
290
290 #check if lock was made
291 #check if lock was made
291 r = Repository.get_by_repo_name(HG_REPO)
292 r = Repository.get_by_repo_name(HG_REPO)
292 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
293 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
293
294
294 def test_clone_and_create_lock_git(self):
295 def test_clone_and_create_lock_git(self):
295 # enable locking
296 # enable locking
296 r = Repository.get_by_repo_name(GIT_REPO)
297 r = Repository.get_by_repo_name(GIT_REPO)
297 r.enable_locking = True
298 r.enable_locking = True
298 Session().add(r)
299 Session().add(r)
299 Session().commit()
300 Session().commit()
300 # clone
301 # clone
301 clone_url = _construct_url(GIT_REPO)
302 clone_url = _construct_url(GIT_REPO)
302 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
303 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
303
304
304 #check if lock was made
305 #check if lock was made
305 r = Repository.get_by_repo_name(GIT_REPO)
306 r = Repository.get_by_repo_name(GIT_REPO)
306 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
307 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
307
308
308 def test_clone_after_repo_was_locked_hg(self):
309 def test_clone_after_repo_was_locked_hg(self):
309 #lock repo
310 #lock repo
310 r = Repository.get_by_repo_name(HG_REPO)
311 r = Repository.get_by_repo_name(HG_REPO)
311 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
312 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
312 #pull fails since repo is locked
313 #pull fails since repo is locked
313 clone_url = _construct_url(HG_REPO)
314 clone_url = _construct_url(HG_REPO)
314 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
315 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
315 msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
316 msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
316 % (HG_REPO, TEST_USER_ADMIN_LOGIN))
317 % (HG_REPO, TEST_USER_ADMIN_LOGIN))
317 assert msg in stderr
318 assert msg in stderr
318
319
319 def test_clone_after_repo_was_locked_git(self):
320 def test_clone_after_repo_was_locked_git(self):
320 #lock repo
321 #lock repo
321 r = Repository.get_by_repo_name(GIT_REPO)
322 r = Repository.get_by_repo_name(GIT_REPO)
322 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
323 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
323 #pull fails since repo is locked
324 #pull fails since repo is locked
324 clone_url = _construct_url(GIT_REPO)
325 clone_url = _construct_url(GIT_REPO)
325 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
326 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
326 msg = ("""423 Repository `%s` locked by user `%s`"""
327 msg = ("""423 Repository `%s` locked by user `%s`"""
327 % (GIT_REPO, TEST_USER_ADMIN_LOGIN))
328 % (GIT_REPO, TEST_USER_ADMIN_LOGIN))
328 assert msg in stderr
329 assert msg in stderr
329
330
330 def test_push_on_locked_repo_by_other_user_hg(self):
331 def test_push_on_locked_repo_by_other_user_hg(self):
331 #clone some temp
332 #clone some temp
332 DEST = _get_tmp_dir()
333 DEST = _get_tmp_dir()
333 clone_url = _construct_url(HG_REPO, dest=DEST)
334 clone_url = _construct_url(HG_REPO, dest=DEST)
334 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
335 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
335
336
336 #lock repo
337 #lock repo
337 r = Repository.get_by_repo_name(HG_REPO)
338 r = Repository.get_by_repo_name(HG_REPO)
338 # let this user actually push !
339 # let this user actually push !
339 RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
340 RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
340 perm='repository.write')
341 perm='repository.write')
341 Session().commit()
342 Session().commit()
342 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
343 Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
343
344
344 #push fails repo is locked by other user !
345 #push fails repo is locked by other user !
345 stdout, stderr = _add_files_and_push('hg', DEST,
346 stdout, stderr = _add_files_and_push('hg', DEST,
346 user=TEST_USER_REGULAR_LOGIN,
347 user=TEST_USER_REGULAR_LOGIN,
347 passwd=TEST_USER_REGULAR_PASS)
348 passwd=TEST_USER_REGULAR_PASS)
348 msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
349 msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
349 % (HG_REPO, TEST_USER_ADMIN_LOGIN))
350 % (HG_REPO, TEST_USER_ADMIN_LOGIN))
350 assert msg in stderr
351 assert msg in stderr
351
352
352 #TODO: fix me ! somehow during tests hooks don't get called on GIT
353 #TODO: fix me ! somehow during tests hooks don't get called on GIT
353 # def test_push_on_locked_repo_by_other_user_git(self):
354 # def test_push_on_locked_repo_by_other_user_git(self):
354 # #clone some temp
355 # #clone some temp
355 # DEST = _get_tmp_dir()
356 # DEST = _get_tmp_dir()
356 # clone_url = _construct_url(GIT_REPO, dest=DEST)
357 # clone_url = _construct_url(GIT_REPO, dest=DEST)
357 # stdout, stderr = Command('/tmp').execute('git clone', clone_url)
358 # stdout, stderr = Command('/tmp').execute('git clone', clone_url)
358 #
359 #
359 # #lock repo
360 # #lock repo
360 # r = Repository.get_by_repo_name(GIT_REPO)
361 # r = Repository.get_by_repo_name(GIT_REPO)
361 # # let this user actually push !
362 # # let this user actually push !
362 # RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
363 # RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
363 # perm='repository.write')
364 # perm='repository.write')
364 # Session().commit()
365 # Session().commit()
365 # Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
366 # Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
366 #
367 #
367 # #push fails repo is locked by other user !
368 # #push fails repo is locked by other user !
368 # stdout, stderr = _add_files_and_push('git', DEST,
369 # stdout, stderr = _add_files_and_push('git', DEST,
369 # user=TEST_USER_REGULAR_LOGIN,
370 # user=TEST_USER_REGULAR_LOGIN,
370 # passwd=TEST_USER_REGULAR_PASS)
371 # passwd=TEST_USER_REGULAR_PASS)
371 # msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
372 # msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
372 # % (GIT_REPO, TEST_USER_ADMIN_LOGIN))
373 # % (GIT_REPO, TEST_USER_ADMIN_LOGIN))
373 # #TODO: fix this somehow later on GIT, GIT is stupid and even if we throw
374 # #TODO: fix this somehow later on GIT, GIT is stupid and even if we throw
374 # # back 423 to it, it makes ANOTHER request and we fail there with 405 :/
375 # # back 423 to it, it makes ANOTHER request and we fail there with 405 :/
375 # msg = "405 Method Not Allowed"
376 # msg = "405 Method Not Allowed"
376 # assert msg in stderr
377 # assert msg in stderr
377
378
378 def test_push_unlocks_repository_hg(self):
379 def test_push_unlocks_repository_hg(self):
379 # enable locking
380 # enable locking
380 r = Repository.get_by_repo_name(HG_REPO)
381 r = Repository.get_by_repo_name(HG_REPO)
381 r.enable_locking = True
382 r.enable_locking = True
382 Session().add(r)
383 Session().add(r)
383 Session().commit()
384 Session().commit()
384 #clone some temp
385 #clone some temp
385 DEST = _get_tmp_dir()
386 DEST = _get_tmp_dir()
386 clone_url = _construct_url(HG_REPO, dest=DEST)
387 clone_url = _construct_url(HG_REPO, dest=DEST)
387 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
388 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
388
389
389 #check for lock repo after clone
390 #check for lock repo after clone
390 r = Repository.get_by_repo_name(HG_REPO)
391 r = Repository.get_by_repo_name(HG_REPO)
391 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
392 assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
392
393
393 #push is ok and repo is now unlocked
394 #push is ok and repo is now unlocked
394 stdout, stderr = _add_files_and_push('hg', DEST)
395 stdout, stderr = _add_files_and_push('hg', DEST)
395 assert ('remote: Released lock on repo `%s`' % HG_REPO) in stdout
396 assert ('remote: Released lock on repo `%s`' % HG_REPO) in stdout
396 #we need to cleanup the Session Here !
397 #we need to cleanup the Session Here !
397 Session.remove()
398 Session.remove()
398 r = Repository.get_by_repo_name(HG_REPO)
399 r = Repository.get_by_repo_name(HG_REPO)
399 assert r.locked == [None, None]
400 assert r.locked == [None, None]
400
401
401 #TODO: fix me ! somehow during tests hooks don't get called on GIT
402 #TODO: fix me ! somehow during tests hooks don't get called on GIT
402 # def test_push_unlocks_repository_git(self):
403 # def test_push_unlocks_repository_git(self):
403 # # enable locking
404 # # enable locking
404 # r = Repository.get_by_repo_name(GIT_REPO)
405 # r = Repository.get_by_repo_name(GIT_REPO)
405 # r.enable_locking = True
406 # r.enable_locking = True
406 # Session().add(r)
407 # Session().add(r)
407 # Session().commit()
408 # Session().commit()
408 # #clone some temp
409 # #clone some temp
409 # DEST = _get_tmp_dir()
410 # DEST = _get_tmp_dir()
410 # clone_url = _construct_url(GIT_REPO, dest=DEST)
411 # clone_url = _construct_url(GIT_REPO, dest=DEST)
411 # stdout, stderr = Command('/tmp').execute('git clone', clone_url)
412 # stdout, stderr = Command('/tmp').execute('git clone', clone_url)
412 #
413 #
413 # #check for lock repo after clone
414 # #check for lock repo after clone
414 # r = Repository.get_by_repo_name(GIT_REPO)
415 # r = Repository.get_by_repo_name(GIT_REPO)
415 # assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
416 # assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
416 #
417 #
417 # #push is ok and repo is now unlocked
418 # #push is ok and repo is now unlocked
418 # stdout, stderr = _add_files_and_push('git', DEST)
419 # stdout, stderr = _add_files_and_push('git', DEST)
419 # #assert ('remote: Released lock on repo `%s`' % GIT_REPO) in stdout
420 # #assert ('remote: Released lock on repo `%s`' % GIT_REPO) in stdout
420 # #we need to cleanup the Session Here !
421 # #we need to cleanup the Session Here !
421 # Session.remove()
422 # Session.remove()
422 # r = Repository.get_by_repo_name(GIT_REPO)
423 # r = Repository.get_by_repo_name(GIT_REPO)
423 # assert r.locked == [None, None]
424 # assert r.locked == [None, None]
424
425
425 def test_ip_restriction_hg(self):
426 def test_ip_restriction_hg(self):
426 user_model = UserModel()
427 user_model = UserModel()
427 new_ip = user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
428 try:
428 Session().commit()
429 user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
430 Session().commit()
431 clone_url = _construct_url(HG_REPO)
432 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
433 assert 'abort: HTTP Error 403: Forbidden' in stderr
434 finally:
435 #release IP restrictions
436 for ip in UserIpMap.getAll():
437 UserIpMap.delete(ip.ip_id)
438 Session().commit()
439
440 time.sleep(2)
429 clone_url = _construct_url(HG_REPO)
441 clone_url = _construct_url(HG_REPO)
430 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
442 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
431 assert 'abort: HTTP Error 403: Forbidden' in stderr
432
433 #release IP restrictions
434 clone_url = _construct_url(HG_REPO)
435 user_model.delete_extra_ip(TEST_USER_ADMIN_LOGIN, new_ip.ip_id)
436 Session().commit()
437 stdout, stderr = Command('/tmp').execute('hg clone', clone_url)
438
443
439 assert 'requesting all changes' in stdout
444 assert 'requesting all changes' in stdout
440 assert 'adding changesets' in stdout
445 assert 'adding changesets' in stdout
441 assert 'adding manifests' in stdout
446 assert 'adding manifests' in stdout
442 assert 'adding file changes' in stdout
447 assert 'adding file changes' in stdout
443
448
444 assert stderr == ''
449 assert stderr == ''
445
450
446 def test_ip_restriction_git(self):
451 def test_ip_restriction_git(self):
447 user_model = UserModel()
452 user_model = UserModel()
448 new_ip = user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
453 try:
449 Session().commit()
454 user_model.add_extra_ip(TEST_USER_ADMIN_LOGIN, '10.10.10.10/32')
455 Session().commit()
456 clone_url = _construct_url(GIT_REPO)
457 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
458 assert 'error: The requested URL returned error: 403 Forbidden' in stderr
459 finally:
460 #release IP restrictions
461 for ip in UserIpMap.getAll():
462 UserIpMap.delete(ip.ip_id)
463 Session().commit()
464
465 time.sleep(2)
450 clone_url = _construct_url(GIT_REPO)
466 clone_url = _construct_url(GIT_REPO)
451 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
467 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
452 assert 'error: The requested URL returned error: 403 Forbidden' in stderr
453
454 #release IP restrictions
455 clone_url = _construct_url(GIT_REPO)
456 user_model.delete_extra_ip(TEST_USER_ADMIN_LOGIN, new_ip.ip_id)
457 Session().commit()
458 stdout, stderr = Command('/tmp').execute('git clone', clone_url)
459
468
460 assert 'Cloning into' in stdout
469 assert 'Cloning into' in stdout
461 assert stderr == ''
470 assert stderr == ''
@@ -1,298 +1,298 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 pdebug = false
10 pdebug = false
11 ################################################################################
11 ################################################################################
12 ## Uncomment and replace with the address which should receive ##
12 ## Uncomment and replace with the address which should receive ##
13 ## any error reports after application crash ##
13 ## any error reports after application crash ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16 #email_to = admin@localhost
16 #email_to = admin@localhost
17 #error_email_from = paste_error@localhost
17 #error_email_from = paste_error@localhost
18 #app_email_from = rhodecode-noreply@localhost
18 #app_email_from = rhodecode-noreply@localhost
19 #error_message =
19 #error_message =
20 #email_prefix = [RhodeCode]
20 #email_prefix = [RhodeCode]
21
21
22 #smtp_server = mail.server.com
22 #smtp_server = mail.server.com
23 #smtp_username =
23 #smtp_username =
24 #smtp_password =
24 #smtp_password =
25 #smtp_port =
25 #smtp_port =
26 #smtp_use_tls = false
26 #smtp_use_tls = false
27 #smtp_use_ssl = true
27 #smtp_use_ssl = true
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 #smtp_auth =
29 #smtp_auth =
30
30
31 [server:main]
31 [server:main]
32 ##nr of threads to spawn
32 ##nr of threads to spawn
33 #threadpool_workers = 5
33 threadpool_workers = 5
34
34
35 ##max request before thread respawn
35 ##max request before thread respawn
36 #threadpool_max_requests = 2
36 threadpool_max_requests = 2
37
37
38 ##option to use threads of process
38 ##option to use threads of process
39 #use_threadpool = true
39 use_threadpool = true
40
40
41 #use = egg:Paste#http
41 use = egg:Paste#http
42 use = egg:waitress#main
42 #use = egg:waitress#main
43 host = 127.0.0.1
43 host = 127.0.0.1
44 port = 5000
44 port = 5000
45
45
46 [app:main]
46 [app:main]
47 use = egg:rhodecode
47 use = egg:rhodecode
48 full_stack = true
48 full_stack = true
49 static_files = true
49 static_files = true
50 lang=en
50 lang=en
51 cache_dir = /tmp/rc/data
51 cache_dir = /tmp/rc/data
52 index_dir = /tmp/rc/index
52 index_dir = /tmp/rc/index
53 app_instance_uuid = develop-test
53 app_instance_uuid = develop-test
54 cut_off_limit = 256000
54 cut_off_limit = 256000
55 force_https = false
55 force_https = false
56 commit_parse_limit = 25
56 commit_parse_limit = 25
57 use_gravatar = true
57 use_gravatar = true
58 container_auth_enabled = false
58 container_auth_enabled = false
59 proxypass_auth_enabled = false
59 proxypass_auth_enabled = false
60
60
61
61
62 ## overwrite schema of clone url
62 ## overwrite schema of clone url
63 ## available vars:
63 ## available vars:
64 ## scheme - http/https
64 ## scheme - http/https
65 ## user - current user
65 ## user - current user
66 ## pass - password
66 ## pass - password
67 ## netloc - network location
67 ## netloc - network location
68 ## path - usually repo_name
68 ## path - usually repo_name
69
69
70 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
70 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
71
71
72 ## issue tracking mapping for commits messages
72 ## issue tracking mapping for commits messages
73 ## comment out issue_pat, issue_server, issue_prefix to enable
73 ## comment out issue_pat, issue_server, issue_prefix to enable
74
74
75 ## pattern to get the issues from commit messages
75 ## pattern to get the issues from commit messages
76 ## default one used here is #<numbers> with a regex passive group for `#`
76 ## default one used here is #<numbers> with a regex passive group for `#`
77 ## {id} will be all groups matched from this pattern
77 ## {id} will be all groups matched from this pattern
78
78
79 issue_pat = (?:\s*#)(\d+)
79 issue_pat = (?:\s*#)(\d+)
80
80
81 ## server url to the issue, each {id} will be replaced with match
81 ## server url to the issue, each {id} will be replaced with match
82 ## fetched from the regex and {repo} is replaced with repository name
82 ## fetched from the regex and {repo} is replaced with repository name
83
83
84 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
84 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
85
85
86 ## prefix to add to link to indicate it's an url
86 ## prefix to add to link to indicate it's an url
87 ## #314 will be replaced by <issue_prefix><id>
87 ## #314 will be replaced by <issue_prefix><id>
88
88
89 issue_prefix = #
89 issue_prefix = #
90
90
91 ## instance-id prefix
91 ## instance-id prefix
92 ## a prefix key for this instance used for cache invalidation when running
92 ## a prefix key for this instance used for cache invalidation when running
93 ## multiple instances of rhodecode, make sure it's globally unique for
93 ## multiple instances of rhodecode, make sure it's globally unique for
94 ## all running rhodecode instances. Leave empty if you don't use it
94 ## all running rhodecode instances. Leave empty if you don't use it
95 instance_id =
95 instance_id =
96
96
97 ## alternative return HTTP header for failed authentication. Default HTTP
97 ## alternative return HTTP header for failed authentication. Default HTTP
98 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
98 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
99 ## handling that. Set this variable to 403 to return HTTPForbidden
99 ## handling that. Set this variable to 403 to return HTTPForbidden
100 auth_ret_code =
100 auth_ret_code =
101
101
102 ####################################
102 ####################################
103 ### CELERY CONFIG ####
103 ### CELERY CONFIG ####
104 ####################################
104 ####################################
105 use_celery = false
105 use_celery = false
106 broker.host = localhost
106 broker.host = localhost
107 broker.vhost = rabbitmqhost
107 broker.vhost = rabbitmqhost
108 broker.port = 5672
108 broker.port = 5672
109 broker.user = rabbitmq
109 broker.user = rabbitmq
110 broker.password = qweqwe
110 broker.password = qweqwe
111
111
112 celery.imports = rhodecode.lib.celerylib.tasks
112 celery.imports = rhodecode.lib.celerylib.tasks
113
113
114 celery.result.backend = amqp
114 celery.result.backend = amqp
115 celery.result.dburi = amqp://
115 celery.result.dburi = amqp://
116 celery.result.serialier = json
116 celery.result.serialier = json
117
117
118 #celery.send.task.error.emails = true
118 #celery.send.task.error.emails = true
119 #celery.amqp.task.result.expires = 18000
119 #celery.amqp.task.result.expires = 18000
120
120
121 celeryd.concurrency = 2
121 celeryd.concurrency = 2
122 #celeryd.log.file = celeryd.log
122 #celeryd.log.file = celeryd.log
123 celeryd.log.level = debug
123 celeryd.log.level = debug
124 celeryd.max.tasks.per.child = 1
124 celeryd.max.tasks.per.child = 1
125
125
126 #tasks will never be sent to the queue, but executed locally instead.
126 #tasks will never be sent to the queue, but executed locally instead.
127 celery.always.eager = false
127 celery.always.eager = false
128
128
129 ####################################
129 ####################################
130 ### BEAKER CACHE ####
130 ### BEAKER CACHE ####
131 ####################################
131 ####################################
132 beaker.cache.data_dir=/tmp/rc/data/cache/data
132 beaker.cache.data_dir=/tmp/rc/data/cache/data
133 beaker.cache.lock_dir=/tmp/rc/data/cache/lock
133 beaker.cache.lock_dir=/tmp/rc/data/cache/lock
134
134
135 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
135 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
136
136
137 beaker.cache.super_short_term.type=memory
137 beaker.cache.super_short_term.type=memory
138 beaker.cache.super_short_term.expire=1
138 beaker.cache.super_short_term.expire=1
139 beaker.cache.super_short_term.key_length = 256
139 beaker.cache.super_short_term.key_length = 256
140
140
141 beaker.cache.short_term.type=memory
141 beaker.cache.short_term.type=memory
142 beaker.cache.short_term.expire=60
142 beaker.cache.short_term.expire=60
143 beaker.cache.short_term.key_length = 256
143 beaker.cache.short_term.key_length = 256
144
144
145 beaker.cache.long_term.type=memory
145 beaker.cache.long_term.type=memory
146 beaker.cache.long_term.expire=36000
146 beaker.cache.long_term.expire=36000
147 beaker.cache.long_term.key_length = 256
147 beaker.cache.long_term.key_length = 256
148
148
149 beaker.cache.sql_cache_short.type=memory
149 beaker.cache.sql_cache_short.type=memory
150 beaker.cache.sql_cache_short.expire=1
150 beaker.cache.sql_cache_short.expire=1
151 beaker.cache.sql_cache_short.key_length = 256
151 beaker.cache.sql_cache_short.key_length = 256
152
152
153 beaker.cache.sql_cache_med.type=memory
153 beaker.cache.sql_cache_med.type=memory
154 beaker.cache.sql_cache_med.expire=360
154 beaker.cache.sql_cache_med.expire=360
155 beaker.cache.sql_cache_med.key_length = 256
155 beaker.cache.sql_cache_med.key_length = 256
156
156
157 beaker.cache.sql_cache_long.type=file
157 beaker.cache.sql_cache_long.type=file
158 beaker.cache.sql_cache_long.expire=3600
158 beaker.cache.sql_cache_long.expire=3600
159 beaker.cache.sql_cache_long.key_length = 256
159 beaker.cache.sql_cache_long.key_length = 256
160
160
161 ####################################
161 ####################################
162 ### BEAKER SESSION ####
162 ### BEAKER SESSION ####
163 ####################################
163 ####################################
164 ## Type of storage used for the session, current types are
164 ## Type of storage used for the session, current types are
165 ## dbm, file, memcached, database, and memory.
165 ## dbm, file, memcached, database, and memory.
166 ## The storage uses the Container API
166 ## The storage uses the Container API
167 ## that is also used by the cache system.
167 ## that is also used by the cache system.
168
168
169 ## db session example
169 ## db session example
170
170
171 #beaker.session.type = ext:database
171 #beaker.session.type = ext:database
172 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
172 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
173 #beaker.session.table_name = db_session
173 #beaker.session.table_name = db_session
174
174
175 ## encrypted cookie session, good for many instances
175 ## encrypted cookie session, good for many instances
176 #beaker.session.type = cookie
176 #beaker.session.type = cookie
177
177
178 beaker.session.type = file
178 beaker.session.type = file
179 beaker.session.key = rhodecode
179 beaker.session.key = rhodecode
180 # secure cookie requires AES python libraries
180 # secure cookie requires AES python libraries
181 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
181 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
182 #beaker.session.validate_key = 9712sds2212c--zxc123
182 #beaker.session.validate_key = 9712sds2212c--zxc123
183 beaker.session.timeout = 36000
183 beaker.session.timeout = 36000
184 beaker.session.httponly = true
184 beaker.session.httponly = true
185
185
186 ## uncomment for https secure cookie
186 ## uncomment for https secure cookie
187 beaker.session.secure = false
187 beaker.session.secure = false
188
188
189 ##auto save the session to not to use .save()
189 ##auto save the session to not to use .save()
190 beaker.session.auto = False
190 beaker.session.auto = False
191
191
192 ##true exire at browser close
192 ##true exire at browser close
193 #beaker.session.cookie_expires = 3600
193 #beaker.session.cookie_expires = 3600
194
194
195
195
196 ################################################################################
196 ################################################################################
197 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
197 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
198 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
198 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
199 ## execute malicious code after an exception is raised. ##
199 ## execute malicious code after an exception is raised. ##
200 ################################################################################
200 ################################################################################
201 #set debug = false
201 #set debug = false
202
202
203 ##################################
203 ##################################
204 ### LOGVIEW CONFIG ###
204 ### LOGVIEW CONFIG ###
205 ##################################
205 ##################################
206 logview.sqlalchemy = #faa
206 logview.sqlalchemy = #faa
207 logview.pylons.templating = #bfb
207 logview.pylons.templating = #bfb
208 logview.pylons.util = #eee
208 logview.pylons.util = #eee
209
209
210 #########################################################
210 #########################################################
211 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
211 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
212 #########################################################
212 #########################################################
213 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode_test.sqlite
213 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode_test.sqlite
214 #sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_test
214 #sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_test
215 #sqlalchemy.db1.url = mysql://root:qwe@localhost/rhodecode_test
215 #sqlalchemy.db1.url = mysql://root:qwe@localhost/rhodecode_test
216
216
217 sqlalchemy.db1.echo = false
217 sqlalchemy.db1.echo = false
218 sqlalchemy.db1.pool_recycle = 3600
218 sqlalchemy.db1.pool_recycle = 3600
219 sqlalchemy.db1.convert_unicode = true
219 sqlalchemy.db1.convert_unicode = true
220
220
221 ################################
221 ################################
222 ### LOGGING CONFIGURATION ####
222 ### LOGGING CONFIGURATION ####
223 ################################
223 ################################
224 [loggers]
224 [loggers]
225 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
225 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
226
226
227 [handlers]
227 [handlers]
228 keys = console
228 keys = console
229
229
230 [formatters]
230 [formatters]
231 keys = generic, color_formatter
231 keys = generic, color_formatter
232
232
233 #############
233 #############
234 ## LOGGERS ##
234 ## LOGGERS ##
235 #############
235 #############
236 [logger_root]
236 [logger_root]
237 level = DEBUG
237 level = DEBUG
238 handlers = console
238 handlers = console
239
239
240 [logger_routes]
240 [logger_routes]
241 level = DEBUG
241 level = DEBUG
242 handlers =
242 handlers =
243 qualname = routes.middleware
243 qualname = routes.middleware
244 # "level = DEBUG" logs the route matched and routing variables.
244 # "level = DEBUG" logs the route matched and routing variables.
245 propagate = 1
245 propagate = 1
246
246
247 [logger_beaker]
247 [logger_beaker]
248 level = DEBUG
248 level = DEBUG
249 handlers =
249 handlers =
250 qualname = beaker.container
250 qualname = beaker.container
251 propagate = 1
251 propagate = 1
252
252
253 [logger_templates]
253 [logger_templates]
254 level = INFO
254 level = INFO
255 handlers =
255 handlers =
256 qualname = pylons.templating
256 qualname = pylons.templating
257 propagate = 1
257 propagate = 1
258
258
259 [logger_rhodecode]
259 [logger_rhodecode]
260 level = DEBUG
260 level = DEBUG
261 handlers =
261 handlers =
262 qualname = rhodecode
262 qualname = rhodecode
263 propagate = 1
263 propagate = 1
264
264
265 [logger_sqlalchemy]
265 [logger_sqlalchemy]
266 level = ERROR
266 level = ERROR
267 handlers = console
267 handlers = console
268 qualname = sqlalchemy.engine
268 qualname = sqlalchemy.engine
269 propagate = 0
269 propagate = 0
270
270
271 [logger_whoosh_indexer]
271 [logger_whoosh_indexer]
272 level = DEBUG
272 level = DEBUG
273 handlers =
273 handlers =
274 qualname = whoosh_indexer
274 qualname = whoosh_indexer
275 propagate = 1
275 propagate = 1
276
276
277 ##############
277 ##############
278 ## HANDLERS ##
278 ## HANDLERS ##
279 ##############
279 ##############
280
280
281 [handler_console]
281 [handler_console]
282 class = StreamHandler
282 class = StreamHandler
283 args = (sys.stderr,)
283 args = (sys.stderr,)
284 level = NOTSET
284 level = NOTSET
285 formatter = generic
285 formatter = generic
286
286
287 ################
287 ################
288 ## FORMATTERS ##
288 ## FORMATTERS ##
289 ################
289 ################
290
290
291 [formatter_generic]
291 [formatter_generic]
292 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
292 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
293 datefmt = %Y-%m-%d %H:%M:%S
293 datefmt = %Y-%m-%d %H:%M:%S
294
294
295 [formatter_color_formatter]
295 [formatter_color_formatter]
296 class=rhodecode.lib.colored_formatter.ColorFormatter
296 class=rhodecode.lib.colored_formatter.ColorFormatter
297 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
297 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
298 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
298 datefmt = %Y-%m-%d %H:%M:%S
General Comments 0
You need to be logged in to leave comments. Login now