|
a/Allura/allura/tests/test_helpers.py |
|
b/Allura/allura/tests/test_helpers.py |
|
... |
|
... |
50 |
u = M.User.anonymous()
|
50 |
u = M.User.anonymous()
|
51 |
pr = u.project_role()
|
51 |
pr = u.project_role()
|
52 |
assert h.make_roles([pr._id]).next() == pr
|
52 |
assert h.make_roles([pr._id]).next() == pr
|
53 |
|
53 |
|
54 |
def test_context_setters():
|
54 |
def test_context_setters():
|
55 |
h.set_context('test', 'wiki')
|
55 |
h.set_context('test', 'wiki', neighborhood='Projects')
|
56 |
assert c.project is not None
|
56 |
assert c.project is not None
|
57 |
assert c.app is not None
|
57 |
assert c.app is not None
|
58 |
cfg_id = c.app.config._id
|
58 |
cfg_id = c.app.config._id
|
59 |
h.set_context('test', app_config_id=cfg_id)
|
59 |
h.set_context('test', app_config_id=cfg_id, neighborhood='Projects')
|
60 |
assert c.project is not None
|
60 |
assert c.project is not None
|
61 |
assert c.app is not None
|
61 |
assert c.app is not None
|
62 |
h.set_context('test', app_config_id=str(cfg_id))
|
62 |
h.set_context('test', app_config_id=str(cfg_id), neighborhood='Projects')
|
63 |
assert c.project is not None
|
63 |
assert c.project is not None
|
64 |
assert c.app is not None
|
64 |
assert c.app is not None
|
65 |
c.project = c.app = None
|
65 |
c.project = c.app = None
|
66 |
with h.push_context('test', 'wiki'):
|
66 |
with h.push_context('test', 'wiki', neighborhood='Projects'):
|
67 |
assert c.project is not None
|
67 |
assert c.project is not None
|
68 |
assert c.app is not None
|
68 |
assert c.app is not None
|
69 |
assert c.project == c.app == None
|
69 |
assert c.project == c.app == None
|
70 |
with h.push_context('test', app_config_id=cfg_id):
|
70 |
with h.push_context('test', app_config_id=cfg_id, neighborhood='Projects'):
|
71 |
assert c.project is not None
|
71 |
assert c.project is not None
|
72 |
assert c.app is not None
|
72 |
assert c.app is not None
|
73 |
assert c.project == c.app == None
|
73 |
assert c.project == c.app == None
|
74 |
with h.push_context('test', app_config_id=str(cfg_id)):
|
74 |
with h.push_context('test', app_config_id=str(cfg_id), neighborhood='Projects'):
|
75 |
assert c.project is not None
|
75 |
assert c.project is not None
|
76 |
assert c.app is not None
|
76 |
assert c.app is not None
|
77 |
assert c.project == c.app == None
|
77 |
assert c.project == c.app == None
|
78 |
del c.project
|
78 |
del c.project
|
79 |
del c.app
|
79 |
del c.app
|
80 |
with h.push_context('test', app_config_id=str(cfg_id)):
|
80 |
with h.push_context('test', app_config_id=str(cfg_id), neighborhood='Projects'):
|
81 |
assert c.project is not None
|
81 |
assert c.project is not None
|
82 |
assert c.app is not None
|
82 |
assert c.app is not None
|
83 |
assert not hasattr(c, 'project')
|
83 |
assert not hasattr(c, 'project')
|
84 |
assert not hasattr(c, 'app')
|
84 |
assert not hasattr(c, 'app')
|
85 |
|
85 |
|