tests: check custom backoffice directories are properly loaded
This commit is contained in:
parent
a52481cc3a
commit
c8b78b6f0c
|
@ -38,10 +38,14 @@ def setup_module(module):
|
|||
def create_superuser():
|
||||
global user1
|
||||
if pub.user_class.has_key('admin'):
|
||||
user1 = pub.user_class.get('admin')
|
||||
user1.is_admin = True
|
||||
user1.roles = []
|
||||
return
|
||||
user1 = pub.user_class(name='admin')
|
||||
user1.id = 'admin'
|
||||
user1.is_admin = True
|
||||
user1.roles = []
|
||||
user1.store()
|
||||
|
||||
account1 = PasswordAccount(id='admin')
|
||||
|
@ -67,3 +71,28 @@ def test_with_superuser():
|
|||
resp = app.get('/backoffice/')
|
||||
# this makes sure the extension loaded properly
|
||||
assert '<span id="applabel">Publik</span>' in resp.body
|
||||
|
||||
def test_directory_registration():
|
||||
create_superuser()
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/links/')
|
||||
|
||||
def test_general_admin_permissions():
|
||||
create_superuser()
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/settings/', status=200)
|
||||
pub.cfg['admin-permissions'] = {'settings': ['XXX']}
|
||||
pub.write_cfg()
|
||||
resp = app.get('/backoffice/settings/', status=403)
|
||||
user1.roles = ['XXX']
|
||||
user1.store()
|
||||
resp = app.get('/backoffice/settings/', status=200)
|
||||
del pub.cfg['admin-permissions']
|
||||
pub.write_cfg()
|
||||
|
||||
def test_aq_permissions_panel():
|
||||
create_superuser()
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/settings/')
|
||||
assert 'aq/permissions' in resp.body
|
||||
resp = app.get('/backoffice/settings/aq/permissions')
|
||||
|
|
|
@ -7,7 +7,7 @@ from quixote.wsgi import QWIP
|
|||
|
||||
from qommon.publisher import set_publisher_class
|
||||
import wcs
|
||||
from wcs import publisher
|
||||
import publisher
|
||||
from wcs.qommon.http_request import HTTPRequest
|
||||
|
||||
QWIP.request_class = HTTPRequest
|
||||
|
|
Reference in New Issue