Back to index

plone3  3.1.7
Public Member Functions
CMFDefault.tests.test_Document.DocumentPUTTests Class Reference
Inheritance diagram for CMFDefault.tests.test_Document.DocumentPUTTests:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.tests.test_Document.DocumentPUTTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_PUTBasicHTML
def test_PUTSimpleXHTML
def test_PutStructuredTextWithHTML
def test_PutStructuredText
def test_PutHtmlWithDoctype
def test_PutHtmlWithoutMetadata

Detailed Description

Definition at line 475 of file test_Document.py.


Member Function Documentation

Definition at line 477 of file test_Document.py.

00477 
00478     def test_PUTBasicHTML(self):
00479         self.REQUEST['BODY'] = BASIC_HTML
00480         d = self._makeOne('foo')
00481         r = d.PUT(self.REQUEST, self.RESPONSE)
00482 
00483         self.failUnless( hasattr(d, 'cooked_text') )
00484         self.assertEqual( d.Format(), 'text/html' )
00485         self.assertEqual( d.title, 'Title in tag' )
00486         self.assertEqual( d.text.find('</body>'), -1 )
00487         self.assertEqual( d.Description(), 'Describe me' )
00488         self.assertEqual( len(d.Contributors()), 3 )
00489         self.assertEqual( d.Contributors()[-1],
00490                           'Benotz, Larry J (larry@benotz.stuff)' )
00491         self.assertEqual( d.cooked_text, '\n  <h1>Not a lot here</h1>\n ' )
00492         self.assertEqual( r.status, 204 )
00493 
00494         subj = list(d.Subject())
00495         self.assertEqual( len(subj), 4 )
00496         subj.sort()
00497         self.assertEqual( subj, [ 'content management'
00498                                 , 'framework'
00499                                 , 'unit tests'
00500                                 , 'zope'
00501                                 ] )

Definition at line 529 of file test_Document.py.

00529 
00530     def test_PutHtmlWithDoctype(self):
00531         html = '%s\n\n  \n   %s' % (DOCTYPE, BASIC_HTML)
00532         self.REQUEST['BODY'] = html
00533         d = self._makeOne('foo')
00534         r = d.PUT(self.REQUEST, self.RESPONSE)
00535 
00536         self.assertEqual( d.Format(), 'text/html' )
00537         self.assertEqual( d.Description(), 'Describe me' )
00538         self.assertEqual( r.status, 204 )

Definition at line 539 of file test_Document.py.

00539 
00540     def test_PutHtmlWithoutMetadata(self):
00541         html = HTML_TEMPLATE % {'title': 'Foo', 'body': 'Bar'}
00542         self.REQUEST['BODY'] = html
00543         d = self._makeOne('foo')
00544         r = d.PUT(self.REQUEST, self.RESPONSE)
00545 
00546         self.assertEqual( d.Title(), 'Foo' )
00547         self.assertEqual( d.Format(), 'text/html' )
00548         self.assertEqual( d.Description(), '' )
00549         self.assertEqual( d.Subject(), () )
00550         self.assertEqual( d.Contributors(), () )
00551         self.assertEqual( d.EffectiveDate(), 'None' )
00552         self.assertEqual( d.ExpirationDate(), 'None' )
00553         self.assertEqual( d.Language(), '' )
00554         self.assertEqual( d.Rights(), '' )
00555         self.assertEqual( r.status, 204 )
00556 

Definition at line 502 of file test_Document.py.

00502 
00503     def test_PUTSimpleXHTML(self):
00504         self.REQUEST['BODY'] = SIMPLE_XHTML
00505         d = self._makeOne('foo')
00506         r = d.PUT(self.REQUEST, self.RESPONSE)
00507 
00508         self.failUnless( hasattr(d, 'cooked_text') )
00509         self.assertEqual( d.Format(), 'text/html' )
00510         self.assertEqual( d.Description(), 'Describe me' )
00511         self.assertEqual( d.cooked_text, '\n  <h1>Not a lot here</h1>\n ' )
00512         self.assertEqual( r.status, 204 )

Definition at line 521 of file test_Document.py.

00521 
00522     def test_PutStructuredText(self):
00523         self.REQUEST['BODY'] = BASIC_STRUCTUREDTEXT
00524         d = self._makeOne('foo')
00525         r = d.PUT(self.REQUEST, self.RESPONSE)
00526 
00527         self.assertEqual( d.Format(), 'text/plain' )
00528         self.assertEqual( r.status, 204 )

Definition at line 513 of file test_Document.py.

00513 
00514     def test_PutStructuredTextWithHTML(self):
00515         self.REQUEST['BODY'] = STX_WITH_HTML
00516         d = self._makeOne('foo')
00517         r = d.PUT(self.REQUEST, self.RESPONSE)
00518 
00519         self.assertEqual( d.Format(), 'text/plain' )
00520         self.assertEqual( r.status, 204 )


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