Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def test_isURLInPortal
def test_isURLInPortalRelative
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 url

Detailed Description

Definition at line 10 of file testURLTool.py.


Member Function Documentation

Definition at line 12 of file testURLTool.py.

00012 
00013     def afterSetUp(self):
00014         self.url = self.portal.portal_url
00015         self.folder.invokeFactory('Folder', id='foo')
00016         self.folder.foo.invokeFactory('Document', id='doc1')
        

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 17 of file testURLTool.py.

00017 
00018     def test_isURLInPortal(self):
00019         iURLiP = self.url.isURLInPortal
00020         self.failUnless(iURLiP(
00021                                'http://nohost/%s/foo' % portal_name))
00022         self.failUnless(iURLiP(
00023                                'http://nohost/%s' % portal_name))
00024         self.failIf(iURLiP(
00025                            'http://nohost2/%s/foo' % portal_name))
00026         self.failUnless(iURLiP(
00027                                'https://nohost/%s/bar' % portal_name))
00028         self.failIf(iURLiP(
00029                            'http://nohost:8080/%s/baz' % portal_name))
00030         self.failIf(iURLiP(
00031                            'http://nohost/'))
00032         self.failIf(iURLiP(
00033                            '/images'))
00034         self.failUnless(iURLiP(
00035                                '/%s/foo' % portal_name))
    

Definition at line 36 of file testURLTool.py.

00036 
00037     def test_isURLInPortalRelative(self):
00038         iURLiP = self.url.isURLInPortal
00039         #non-root relative urls will need a current context to be passed in
00040         self.failUnless(iURLiP(
00041                                'images/img1.jpg'))
00042         self.failUnless(iURLiP(
00043                                './images/img1.jpg'))
00044         self.failUnless(iURLiP( #/plone/Members/test_user_1_/something
00045                                '../something', self.folder.foo.doc1))
00046         self.failUnless(iURLiP( #/plone/Members/afolder
00047                                '../../afolder', self.folder.foo.doc1))
00048         self.failUnless(iURLiP( #/plone/afolder
00049                                '../../../afolder', self.folder.foo.doc1))
00050         self.failIf(iURLiP( #/afolder
00051                            '../../../../afolder', self.folder.foo.doc1))
00052         self.failIf(iURLiP( #/../afolder? How do we have more ../'s than there are parts in the URL?
00053                            '../../../../../afolder', self.folder.foo.doc1))
00054         self.failUnless(iURLiP( #/plone/afolder
00055                                '../../../../%s/afolder' % portal_name ,self.folder.foo.doc1))
00056 


Member Data Documentation

Definition at line 13 of file testURLTool.py.


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