Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFPlone.tests.testControlPanelScripts.TestNoGETControlPannel Class Reference
Inheritance diagram for CMFPlone.tests.testControlPanelScripts.TestNoGETControlPannel:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testControlPanelScripts.TestNoGETControlPannel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_prefsGroupMemberAdd
def test_prefsGroupMemberRemove
def test_prefsGroupEdit
def test_changeOwnership
def test_loginChangePassword
def test_prefsUserManager
def test_prefsGroupModify
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 folder_path
 groups

Private Member Functions

def _onlyPOST

Detailed Description

Definition at line 15 of file testControlPanelScripts.py.


Member Function Documentation

def CMFPlone.tests.testControlPanelScripts.TestNoGETControlPannel._onlyPOST (   self,
  path,
  qstring = '',
  success = 200,
  rpath = None 
) [private]

Definition at line 23 of file testControlPanelScripts.py.

00023 
00024     def _onlyPOST(self, path, qstring='', success=200, rpath=None):
00025         qstring += '&%s=%s' % self.getAuthenticator()
00026         basic_auth = '%s:%s' % ('bribri', 'secret')
00027         env = dict()
00028         if rpath:
00029             env['HTTP_REFERER'] = self.app.absolute_url() + rpath
00030         response = self.publish('%s?%s' % (path, qstring), basic_auth, env,
00031                                 handle_errors=True)
00032         self.assertEqual(response.getStatus(), 403)
00033 
00034         data = StringIO(qstring)
00035         response = self.publish(path, basic_auth, env, request_method='POST',
00036                                 stdin=data)
00037         self.assertEqual(response.getStatus(), success)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 17 of file testControlPanelScripts.py.

00017 
00018     def afterSetUp(self):
00019         self.folder_path = '/'+self.folder.absolute_url(1)
00020         self.setRoles(['Manager'])
00021         self.portal.portal_membership.addMember('bribri', 'secret', ['Manager'], [])
00022         self.login('bribri')

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 62 of file testControlPanelScripts.py.

00062 
00063     def test_changeOwnership(self):
00064         path = self.folder_path + '/change_ownership'
00065         qstring = 'userid=%s' % default_user
00066         self._onlyPOST(path, qstring, success=302)

Here is the call graph for this function:

Definition at line 67 of file testControlPanelScripts.py.

00067 
00068     def test_loginChangePassword(self):
00069         path = self.folder_path + '/login_change_password'
00070         qstring = 'password=foo'
00071         self._onlyPOST(path, qstring)

Here is the call graph for this function:

Definition at line 57 of file testControlPanelScripts.py.

00057 
00058     def test_prefsGroupEdit(self):
00059         path = self.folder_path + '/prefs_group_edit'
00060         qstring = 'addname=%s' % 'foo'
00061         self._onlyPOST(path, qstring, success=302)

Here is the call graph for this function:

Definition at line 38 of file testControlPanelScripts.py.

00038 
00039     def test_prefsGroupMemberAdd(self):
00040         self.groups = self.portal.portal_groups
00041         self.groups.groupWorkspacesCreationFlag = 0
00042         self.groups.addGroup('foo')
00043         path = self.folder_path + '/prefs_group_members_add'
00044         qstring = 'groupname=%s&add:list=%s' % ('foo',default_user)
00045         self._onlyPOST(path, qstring)
00046 

Definition at line 47 of file testControlPanelScripts.py.

00047 
00048     def test_prefsGroupMemberRemove(self):
00049         self.groups = self.portal.portal_groups
00050         self.groups.groupWorkspacesCreationFlag = 0
00051         self.groups.addGroup('foo')
00052         group = self.groups.getGroupById('foo')
00053         group.addMember(default_user)
00054         path = self.folder_path + '/prefs_group_members_delete'
00055         qstring = 'groupname=%s&delete:list=%s' % ('foo',default_user)
00056         self._onlyPOST(path, qstring)

Here is the call graph for this function:

Definition at line 80 of file testControlPanelScripts.py.

00080 
00081     def test_prefsGroupModify(self):
00082         self.groups = self.portal.portal_groups
00083         self.groups.groupWorkspacesCreationFlag = 0
00084         self.groups.addGroup('foo')
00085         path = self.folder_path + '/prefs_group_modify'
00086         qstring = 'group_foo:list=Manager'
00087         self._onlyPOST(path,qstring)
00088         path = self.folder_path + '/prefs_group_modify'
00089         qstring = 'delete:list=foo'
00090         self._onlyPOST(path,qstring)
00091         
00092         

Here is the call graph for this function:

Definition at line 72 of file testControlPanelScripts.py.

00072 
00073     def test_prefsUserManager(self):
00074         path = self.folder_path + '/prefs_user_manage'
00075         qstring = 'users.id:records=%s&users.roles:list:records=Manager' % default_user
00076         self._onlyPOST(path, qstring,success=302)
00077         path = self.folder_path + '/prefs_user_manage'
00078         qstring = 'delete:list=%s' % default_user
00079         self._onlyPOST(path, qstring,success=302)

Here is the call graph for this function:


Member Data Documentation

Definition at line 18 of file testControlPanelScripts.py.

Definition at line 39 of file testControlPanelScripts.py.


The documentation for this class was generated from the following file: