Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFDefault.tests.test_Link.LinkTests Class Reference
Inheritance diagram for CMFDefault.tests.test_Link.LinkTests:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.tests.test_Link.LinkTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def canonTest
def test_z3interfaces
def test_Empty
def test_RFC822
def test_RFC822_w_Continuation
def test_PutWithoutMetadata
def test_fixupMissingScheme
def test_keepRelativeUrl
def test_trailingSlash
def test_otherScheme

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 28 of file test_Link.py.


Member Function Documentation

Definition at line 30 of file test_Link.py.

00030 
00031     def _getTargetClass(self):
00032         from Products.CMFDefault.Link import Link
00033 
00034         return Link

def CMFDefault.tests.test_Link.LinkTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 35 of file test_Link.py.

00035 
00036     def _makeOne(self, *args, **kw):
00037         return self._getTargetClass()(*args, **kw)

Here is the call graph for this function:

Definition at line 38 of file test_Link.py.

00038 
00039     def canonTest(self, table):
00040         for orig, wanted in table.items():
00041             # test with constructor
00042             d = self._makeOne('foo', remote_url=orig)
00043             self.assertEqual(d.getRemoteUrl(), wanted)
00044             # test with edit method too
00045             d = self._makeOne('bar')
00046             d.edit(orig)
00047             self.assertEqual(d.getRemoteUrl(), wanted)

Here is the caller graph for this function:

Definition at line 56 of file test_Link.py.

00056 
00057     def test_Empty( self ):
00058         d = self._makeOne('foo')
00059         self.assertEqual( d.Title(), '' )
00060         self.assertEqual( d.Description(), '' )
00061         self.assertEqual( d.getRemoteUrl(), '' )
00062         self.assertEqual( d.format, 'text/url' )
00063         self.assertEqual( d.URL_FORMAT, 'text/url')
00064 
00065         d = self._makeOne('foo', remote_url='bar')
00066         d.edit('')
00067         self.assertEqual(d.getRemoteUrl(), '')
00068 
00069         d = self._makeOne('foo', remote_url='http://')
00070         self.assertEqual(d.getRemoteUrl(), '')
00071 
00072         d = self._makeOne('foo', remote_url='http:')
00073         self.assertEqual(d.getRemoteUrl(), '')

Definition at line 111 of file test_Link.py.

00111 
00112     def test_fixupMissingScheme(self):
00113         table = {
00114             'http://foo.com':      'http://foo.com',
00115             '//bar.com':           'http://bar.com',
00116             }
00117         self.canonTest(table)

Here is the call graph for this function:

Definition at line 118 of file test_Link.py.

00118 
00119     def test_keepRelativeUrl(self):
00120         table = {
00121             'baz.com':             'baz.com',
00122             'baz2.com/index.html': 'baz2.com/index.html',
00123             '/huh/zoinx.html':     '/huh/zoinx.html',
00124             'hmmm.com/lol.txt':    'hmmm.com/lol.txt',
00125             }
00126         self.canonTest(table)

Here is the call graph for this function:

Definition at line 135 of file test_Link.py.

00135 
00136     def test_otherScheme(self):
00137         table = {
00138             'mailto:user@foo.com':      'mailto:user@foo.com',
00139             'https://bank.com/account': 'https://bank.com/account',
00140             }
00141         self.canonTest(table)
00142 

Here is the call graph for this function:

Definition at line 98 of file test_Link.py.

00098 
00099     def test_PutWithoutMetadata(self):
00100         d = self._makeOne('foo')
00101         d._writeFromPUT( body='' )
00102         self.assertEqual( d.Title(), '' )
00103         self.assertEqual( d.Format(), 'text/url' )
00104         self.assertEqual( d.Description(), '' )
00105         self.assertEqual( d.Subject(), () )
00106         self.assertEqual( d.Contributors(), () )
00107         self.assertEqual( d.EffectiveDate(), 'None' )
00108         self.assertEqual( d.ExpirationDate(), 'None' )
00109         self.assertEqual( d.Language(), '' )
00110         self.assertEqual( d.Rights(), '' )

Definition at line 74 of file test_Link.py.

00074 
00075     def test_RFC822(self):
00076         d = self._makeOne('foo')
00077         d._writeFromPUT( body=BASIC_RFC822 )
00078 
00079         self.assertEqual( d.Title(), 'Zope Community' )
00080         self.assertEqual( d.Description()
00081                         , 'Link to the Zope Community website.' )
00082         self.assertEqual( len(d.Subject()), 3 )
00083         self.assertEqual( d.getRemoteUrl(), 'http://www.zope.org' )

Definition at line 84 of file test_Link.py.

00084 
00085     def test_RFC822_w_Continuation(self):
00086         d = self._makeOne('foo')
00087         d._writeFromPUT( body=RFC822_W_CONTINUATION )
00088         rnlinesplit = compile( r'\r?\n?' )
00089         desc_lines = rnlinesplit.split( d.Description() )
00090 
00091         self.assertEqual( d.Title(), 'Zope Community' )
00092         self.assertEqual( desc_lines[0]
00093                         , 'Link to the Zope Community website,' )
00094         self.assertEqual( desc_lines[1]
00095                         , ' including hundreds of contributed Zope products.' )
00096         self.assertEqual( len(d.Subject()), 3 )
00097         self.assertEqual( d.getRemoteUrl(), 'http://www.zope.org' )

Definition at line 127 of file test_Link.py.

00127 
00128     def test_trailingSlash(self):
00129         table = {
00130             'http://foo.com/bar/': 'http://foo.com/bar/',
00131             'baz.com/':            'baz.com/',
00132             '/baz.org/zoinx/':     '/baz.org/zoinx/',
00133             }
00134         self.canonTest(table)

Here is the call graph for this function:

Definition at line 48 of file test_Link.py.

00048 
00049     def test_z3interfaces(self):
00050         from zope.interface.verify import verifyClass
00051         from Products.CMFDefault.interfaces import ILink
00052         from Products.CMFDefault.interfaces import IMutableLink
00053 
00054         verifyClass(ILink, self._getTargetClass())
00055         verifyClass(IMutableLink, self._getTargetClass())

Here is the call graph for this function:


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