Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ResourceRegistries.tests.testJSRegistry.TestPublishing Class Reference
Inheritance diagram for ResourceRegistries.tests.testJSRegistry.TestPublishing:
Inheritance graph
[legend]
Collaboration diagram for ResourceRegistries.tests.testJSRegistry.TestPublishing:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testPublishJSThroughTool
def testPublishNonMagicJSThroughTool
def testPublishPageWithInlineJS
def testPublishPageWithInlineJS2

Public Attributes

 tool
 toolpath
 folderpath

Detailed Description

Definition at line 444 of file testJSRegistry.py.


Member Function Documentation

Definition at line 446 of file testJSRegistry.py.

00446 
00447     def afterSetUp(self):
00448         self.tool = getattr(self.portal, JSTOOLNAME)
00449         self.tool.clearResources()
00450         self.toolpath = '/' + self.tool.absolute_url(1)
00451         self.folderpath = '/' + self.folder.absolute_url(1)
00452         self.tool.registerScript('test_rr_1.js')
00453         self.folder.invokeFactory('Document', 'index_html')

Definition at line 454 of file testJSRegistry.py.

00454 
00455     def testPublishJSThroughTool(self):
00456         response = self.publish(self.toolpath + '/test_rr_1.js')
00457         self.assertEqual(response.getStatus(), 200)
00458         self.assertEqual(response.getHeader('Content-Type'), 'application/x-javascript;charset=utf-8')

Definition at line 459 of file testJSRegistry.py.

00459 
00460     def testPublishNonMagicJSThroughTool(self):
00461         self.setRoles(['Manager'])
00462         body = """<dtml-var "'joined' + 'string'">"""
00463         self.folder.addDTMLMethod('testmethod', file=body)
00464         self.tool.registerScript('testmethod')
00465         response = self.publish(self.toolpath + '/testmethod')
00466         self.assertEqual(response.getStatus(), 200)
00467         self.assertEqual(response.getHeader('Content-Type'), 'application/x-javascript;charset=utf-8')

Here is the call graph for this function:

Definition at line 468 of file testJSRegistry.py.

00468 
00469     def testPublishPageWithInlineJS(self):
00470         # This one fails from string/utf-8 concatenation
00471         response = self.publish(self.folderpath)
00472         self.assertEqual(response.getStatus(), 200)
00473         self.assertEqual(response.getHeader('Content-Type'),
00474                          'text/html;charset=utf-8')
00475         self.tool.clearResources()
00476         self.tool.registerScript('test_rr_1.js', inline=True)
00477         # Test that the main page retains its content-type
00478         response = self.publish(self.folderpath)
00479         self.assertEqual(response.getHeader('Content-Type'),
00480                          'text/html;charset=utf-8')
00481         self.assertEqual(response.getStatus(), 200)

Definition at line 482 of file testJSRegistry.py.

00482 
00483     def testPublishPageWithInlineJS2(self):
00484         self.tool.clearResources()
00485         # Test that the main page retains its content-type
00486         self.setRoles(['Manager'])
00487         body = """<dtml-call "REQUEST.RESPONSE.setHeader('Content-Type', 'text/javascript')">/*and some js comments too*/ """
00488         self.folder.addDTMLMethod('testmethod', file=body)
00489         self.tool.registerScript('testmethod', inline=True)
00490         response = self.publish(self.folderpath)
00491         self.assertEqual(response.getHeader('Content-Type'),
00492                          'text/html;charset=utf-8')
00493         self.assertEqual(response.getStatus(), 200)

Here is the call graph for this function:


Member Data Documentation

Definition at line 450 of file testJSRegistry.py.

Definition at line 447 of file testJSRegistry.py.

Definition at line 449 of file testJSRegistry.py.


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