|
a/Allura/allura/controllers/test.py |
|
b/Allura/allura/controllers/test.py |
|
... |
|
... |
57 |
super(TestController, self).__init__()
|
57 |
super(TestController, self).__init__()
|
58 |
|
58 |
|
59 |
def _setup_request(self):
|
59 |
def _setup_request(self):
|
60 |
# This code fixes a race condition in our tests
|
60 |
# This code fixes a race condition in our tests
|
61 |
c.project = M.Project.query.get(shortname='test')
|
61 |
c.project = M.Project.query.get(shortname='test')
|
|
|
62 |
count = 20
|
62 |
while c.project is None:
|
63 |
while c.project is None:
|
63 |
import sys, time
|
64 |
import sys, time
|
64 |
time.sleep(0.5)
|
65 |
time.sleep(0.5)
|
65 |
print >> sys.stderr, 'Project "test" not found, retrying...'
|
66 |
log.warning('Project "test" not found, retrying...')
|
66 |
c.project = M.Project.query.get(shortname='test')
|
67 |
c.project = M.Project.query.get(shortname='test')
|
|
|
68 |
count -= 1
|
|
|
69 |
assert count > 0, 'Timeout waiting for test project to appear'
|
67 |
|
70 |
|
68 |
@expose()
|
71 |
@expose()
|
69 |
def _lookup(self, name, *remainder):
|
72 |
def _lookup(self, name, *remainder):
|
70 |
if not h.re_path_portion.match(name):
|
73 |
if not h.re_path_portion.match(name):
|
71 |
raise exc.HTTPNotFound, name
|
74 |
raise exc.HTTPNotFound, name
|
|
... |
|
... |
150 |
|
153 |
|
151 |
@expose()
|
154 |
@expose()
|
152 |
def needs_project_access_ok(self):
|
155 |
def needs_project_access_ok(self):
|
153 |
pred = has_project_access('read')
|
156 |
pred = has_project_access('read')
|
154 |
if not pred():
|
157 |
if not pred():
|
155 |
print 'Inside needs_project_access, c.user = %s' % c.user
|
158 |
log.info('Inside needs_project_access, c.user = %s' % c.user)
|
156 |
require(pred)
|
159 |
require(pred)
|
157 |
return ''
|
160 |
return ''
|
158 |
|
161 |
|
159 |
@expose()
|
162 |
@expose()
|
160 |
def needs_artifact_access_fail(self):
|
163 |
def needs_artifact_access_fail(self):
|