From f680d2a59b9eace5802f219e6b40b9a7012ff1a6 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Mon, 9 Aug 2010 22:52:27 +0200 Subject: [PATCH] add tests for the admin form if used by registered/admin users --- pyweb/mumble/tests.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pyweb/mumble/tests.py b/pyweb/mumble/tests.py index bc2cbf3..f6234eb 100644 --- a/pyweb/mumble/tests.py +++ b/pyweb/mumble/tests.py @@ -168,8 +168,10 @@ RES_SUCCESS = {'success': True} RES_ACCESSDENIED = {'success': False, 'errors': {'': 'access denied'}} RES_PREVALFAIL = {'success': False, 'errors': {'': 'pre-validation failed'}} -LOGIN_SUPERADMIN = {'username': 'svedrin', 'password': 'passwort'} -LOGIN_UNREGUSER = {'username': 'nocheinuser', 'password': 'passwort'} +LOGIN_SUPERADMIN = {'username': 'svedrin', 'password': 'passwort'} +LOGIN_UNREGUSER = {'username': 'unreg', 'password': 'passwort'} +LOGIN_USER = {'username': 'user', 'password': 'passwort'} +LOGIN_ADMIN = {'username': 'admin', 'password': 'passwort'} ############################################################# ### ANON: Unauthed (not logged in) users ### @@ -248,10 +250,30 @@ Unreg_Administration = generateTestCase( ### USER: MumbleUser but not a server admin ### ############################################################# +User_Administration = generateTestCase( + name = "User_Administration", + formname = "MumbleForm", + data = { + 'My': ( {'pk': 1, 'name': 'test server', 'url': '', 'player': ''}, RES_ACCESSDENIED ), + 'Other': ( {'pk': 2, 'name': 'alealejandro', 'url': '', 'player': ''}, RES_ACCESSDENIED ), + }, + login = LOGIN_USER, + ) + ############################################################# ### ADMIN: MumbleUser is a server admin ### ############################################################# +Admin_Administration = generateTestCase( + name = "Admin_Administration", + formname = "MumbleForm", + data = { + 'My': ( {'pk': 1, 'name': 'test server', 'url': '', 'player': ''}, RES_SUCCESS ), + 'Other': ( {'pk': 2, 'name': 'alealejandro', 'url': '', 'player': ''}, RES_ACCESSDENIED ), + }, + login = LOGIN_ADMIN, + ) + ############################################################# ### SUPER: User is superadmin, MumbleUser irrelevant ### #############################################################