##// END OF EJS Templates
fixed error when disabled anonymous access lead to error on server
marcink -
r2714:a2eaa005 beta
parent child Browse files
Show More
@@ -324,6 +324,7 b' class AuthUser(object):'
324 self.email = ''
324 self.email = ''
325 self.is_authenticated = False
325 self.is_authenticated = False
326 self.admin = False
326 self.admin = False
327 self.inherit_default_permissions = False
327 self.permissions = {}
328 self.permissions = {}
328 self._api_key = api_key
329 self._api_key = api_key
329 self.propagate_data()
330 self.propagate_data()
@@ -1,4 +1,7 b''
1 import time
1 from rhodecode.tests import *
2 from rhodecode.tests import *
3 from rhodecode.model.meta import Session
4 from rhodecode.model.db import User
2
5
3
6
4 class TestHomeController(TestController):
7 class TestHomeController(TestController):
@@ -22,3 +25,37 b' class TestHomeController(TestController)'
22 merge" class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232"""
25 merge" class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232"""
23 """dffcd24178a07ffeb5dfc">r173:27cd5cce30c9</a>"""
26 """dffcd24178a07ffeb5dfc">r173:27cd5cce30c9</a>"""
24 )
27 )
28
29 def test_repo_summary_with_anonymous_access_disabled(self):
30 anon = User.get_by_username('default')
31 anon.active = False
32 Session().add(anon)
33 Session().commit()
34 time.sleep(1.5) # must sleep for cache (1s to expire)
35 try:
36 response = self.app.get(url(controller='summary',
37 action='index', repo_name=HG_REPO),
38 status=302)
39 assert 'login' in response.location
40
41 finally:
42 anon = User.get_by_username('default')
43 anon.active = True
44 Session().add(anon)
45 Session().commit()
46
47 def test_index_with_anonymous_access_disabled(self):
48 anon = User.get_by_username('default')
49 anon.active = False
50 Session().add(anon)
51 Session().commit()
52 time.sleep(1.5) # must sleep for cache (1s to expire)
53 try:
54 response = self.app.get(url(controller='home', action='index'),
55 status=302)
56 assert 'login' in response.location
57 finally:
58 anon = User.get_by_username('default')
59 anon.active = True
60 Session().add(anon)
61 Session().commit()
General Comments 0
You need to be logged in to leave comments. Login now