Back to index

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

List of all members.

Public Member Functions

def test_Init
def test_PUT_basic_html
def test_PUT_uppered_html
def test_PUT_entity_in_title
def test_PUT_html_with_doctype
def test_PUT_html_without_newlines
def test_PUT_structured_text

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 87 of file test_NewsItem.py.


Member Function Documentation

Definition at line 89 of file test_NewsItem.py.

00089 
00090     def _getTargetClass(self):
00091         from Products.CMFDefault.NewsItem import NewsItem
00092 
00093         return NewsItem

def CMFDefault.tests.test_NewsItem.NewsItemPUTTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 94 of file test_NewsItem.py.

00094 
00095     def _makeOne(self, *args, **kw):
00096         return self._getTargetClass()(*args, **kw)

Definition at line 97 of file test_NewsItem.py.

00097 
00098     def test_Init(self):
00099         self.REQUEST['BODY'] = BASIC_STRUCTUREDTEXT
00100         d = self._makeOne('foo', text='')
00101         d.PUT(self.REQUEST, self.RESPONSE)
00102 
00103         self.assertEqual( d.Title(), 'My Document' )
00104         self.assertEqual( d.Description(), 'A document by me' )
00105         self.assertEqual( d.Format(), 'text/plain' )
00106         self.assertEqual( d.text_format, 'structured-text' )
00107         self.assertEqual( len(d.Contributors()), 3 )
00108         self.failUnless( d.cooked_text.find('<p>') >= 0 )

Definition at line 109 of file test_NewsItem.py.

00109 
00110     def test_PUT_basic_html(self):
00111         self.REQUEST['BODY']=BASIC_HTML
00112         d = self._makeOne('foo')
00113         d.PUT(self.REQUEST, self.RESPONSE)
00114 
00115         self.assertEqual( d.Title(), 'Title in tag' )
00116         self.assertEqual( d.Description(), 'Describe me' )
00117         self.assertEqual( d.Format(), 'text/html' )
00118         self.assertEqual( d.text_format, 'html' )
00119         self.assertEqual( d.text.find('</body>'), -1 )
00120         self.assertEqual( len(d.Contributors()), 3 )

Definition at line 133 of file test_NewsItem.py.

00133 
00134     def test_PUT_entity_in_title(self):
00135         self.REQUEST['BODY'] = ENTITY_IN_TITLE
00136         d = self._makeOne('foo')
00137         d.PUT(self.REQUEST, self.RESPONSE)
00138 
00139         self.assertEqual( d.Title(), '&Auuml;rger' )

Definition at line 140 of file test_NewsItem.py.

00140 
00141     def test_PUT_html_with_doctype(self):
00142         self.REQUEST['BODY'] = '%s\n%s' % (DOCTYPE, BASIC_HTML)
00143         d = self._makeOne('foo')
00144         d.PUT(self.REQUEST, self.RESPONSE)
00145 
00146         self.assertEqual( d.Description(), 'Describe me' )

Definition at line 147 of file test_NewsItem.py.

00147 
00148     def test_PUT_html_without_newlines(self):
00149         self.REQUEST['BODY'] = ''.join(BASIC_HTML.split('\n'))
00150         d = self._makeOne('foo')
00151         d.PUT(self.REQUEST, self.RESPONSE)
00152 
00153         self.assertEqual( d.Title(), 'Title in tag' )
00154         self.assertEqual( d.Description(), 'Describe me' )
00155         self.assertEqual( d.Format(), 'text/html' )
00156         self.assertEqual( d.text_format, 'html' )
00157         self.assertEqual( d.text.find('</body>'), -1 )
00158         self.assertEqual( len(d.Contributors()), 3 )

Definition at line 159 of file test_NewsItem.py.

00159 
00160     def test_PUT_structured_text(self):
00161         self.REQUEST['BODY'] = BASIC_STRUCTUREDTEXT
00162         d = self._makeOne('foo')
00163         d.PUT( self.REQUEST, self.RESPONSE )
00164 
00165         self.assertEqual( d.Title(), 'My Document')
00166         self.assertEqual( d.Description(), 'A document by me')
00167         self.assertEqual( d.Format(), 'text/plain' )
00168         self.assertEqual( d.text_format, 'structured-text' )
00169         self.assertEqual( len(d.Contributors()), 3 )
00170         self.failUnless( d.cooked_text.find('<p>') >= 0 )
00171 

Definition at line 121 of file test_NewsItem.py.

00121 
00122     def test_PUT_uppered_html(self):
00123         self.REQUEST['BODY'] = BASIC_HTML.upper()
00124         d = self._makeOne('foo')
00125         d.PUT(self.REQUEST, self.RESPONSE)
00126 
00127         self.assertEqual( d.Title(), 'TITLE IN TAG' )
00128         self.assertEqual( d.Description(), 'DESCRIBE ME' )
00129         self.assertEqual( d.Format(), 'text/html' )
00130         self.assertEqual( d.text_format, 'html' )
00131         self.assertEqual( d.text.find('</BODY'), -1 )
00132         self.assertEqual( len(d.Contributors()), 3 )


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