Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
PluggableAuthService.plugins.tests.test_exportimport.CookieAuthHelperExportImportTests Class Reference
Inheritance diagram for PluggableAuthService.plugins.tests.test_exportimport.CookieAuthHelperExportImportTests:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.tests.test_exportimport.CookieAuthHelperExportImportTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_listExportableItems
def test__getExportInfo_default
def test_export_default
def test__getExportInfo_explicitly_set
def test_export_explicitly_set
def test_import_with_title
def test_import_no_title

Private Member Functions

def _getTargetClass
def _makePlugin

Detailed Description

Definition at line 473 of file test_exportimport.py.


Member Function Documentation

Definition at line 475 of file test_exportimport.py.

00475 
00476         def _getTargetClass(self):
00477             from Products.PluggableAuthService.plugins.exportimport \
00478                 import CookieAuthHelperExportImport
00479             return CookieAuthHelperExportImport

Definition at line 480 of file test_exportimport.py.

00480 
00481         def _makePlugin(self, id, *args, **kw):
00482             from Products.PluggableAuthService.plugins.CookieAuthHelper \
00483                 import CookieAuthHelper
00484             return CookieAuthHelper(id, *args, **kw)

Here is the caller graph for this function:

Definition at line 494 of file test_exportimport.py.

00494 
00495         def test__getExportInfo_default(self):
00496             from Products.PluggableAuthService.plugins.CookieAuthHelper \
00497                 import CookieAuthHelper
00498             plugin = self._makePlugin('default').__of__(self.root)
00499             adapter = self._makeOne(plugin)
00500 
00501             info = adapter._getExportInfo()
00502             self.assertEqual(info['title'], None)
00503             self.assertEqual(info['cookie_name'], CookieAuthHelper.cookie_name)
00504             self.assertEqual(info['login_path'], CookieAuthHelper.login_path)

Definition at line 523 of file test_exportimport.py.

00523 
00524         def test__getExportInfo_explicitly_set(self):
00525             TITLE = 'Plugin Title'
00526             COOKIE_NAME = 'COOKIE_NAME'
00527             LOGIN_PATH = 'LOGIN_PATH'
00528             plugin = self._makePlugin('explicit').__of__(self.root)
00529             plugin.title = TITLE
00530             plugin.cookie_name = COOKIE_NAME
00531             plugin.login_path = LOGIN_PATH
00532             adapter = self._makeOne(plugin)
00533 
00534             info = adapter._getExportInfo()
00535             self.assertEqual(info['title'], TITLE)
00536             self.assertEqual(info['cookie_name'], COOKIE_NAME)
00537             self.assertEqual(info['login_path'], LOGIN_PATH)

Definition at line 505 of file test_exportimport.py.

00505 
00506         def test_export_default(self):
00507             from Products.PluggableAuthService.plugins.CookieAuthHelper \
00508                 import CookieAuthHelper as CAH
00509             plugin = self._makePlugin('default').__of__(self.root)
00510             adapter = self._makeOne(plugin)
00511 
00512             context = DummyExportContext(plugin)
00513             adapter.export(context, 'plugins', False)
00514 
00515             self.assertEqual(len(context._wrote), 1)
00516             filename, text, content_type = context._wrote[0]
00517             self.assertEqual(filename, 'plugins/default.xml' )
00518             self._compareDOM(text,
00519                              _COOKIE_AUTH_TEMPLATE_NO_TITLE % (CAH.cookie_name,
00520                                                                CAH.login_path,
00521                                                               ))
00522             self.assertEqual( content_type, 'text/xml' )

Definition at line 538 of file test_exportimport.py.

00538 
00539         def test_export_explicitly_set(self):
00540             TITLE = 'Plugin Title'
00541             COOKIE_NAME = 'COOKIE_NAME'
00542             LOGIN_PATH = 'LOGIN_PATH'
00543             plugin = self._makePlugin('explicit').__of__(self.root)
00544             plugin.title = TITLE
00545             plugin.cookie_name = COOKIE_NAME
00546             plugin.login_path = LOGIN_PATH
00547             adapter = self._makeOne(plugin)
00548 
00549             context = DummyExportContext(plugin)
00550             adapter.export(context, 'plugins', False)
00551 
00552             self.assertEqual(len(context._wrote), 1)
00553             filename, text, content_type = context._wrote[0]
00554             self.assertEqual(filename, 'plugins/explicit.xml' )
00555             self._compareDOM(text,
00556                              _COOKIE_AUTH_TEMPLATE % (TITLE,
00557                                                       COOKIE_NAME,
00558                                                       LOGIN_PATH,
00559                                                      ))
00560             self.assertEqual( content_type, 'text/xml' )

Definition at line 580 of file test_exportimport.py.

00580 
00581         def test_import_no_title(self):
00582             TITLE = 'Plugin Title'
00583             COOKIE_NAME = 'COOKIE_NAME'
00584             LOGIN_PATH = 'LOGIN_PATH'
00585             plugin = self._makePlugin('no_title').__of__(self.root)
00586             plugin.title = TITLE
00587             plugin.cookie_name = COOKIE_NAME
00588             plugin.login_path = LOGIN_PATH
00589             adapter = self._makeOne(plugin)
00590 
00591             context = DummyImportContext(plugin)
00592             context._files['plugins/no_title.xml'
00593                           ] = _COOKIE_AUTH_TEMPLATE_NO_TITLE % (COOKIE_NAME,
00594                                                                 LOGIN_PATH,
00595                                                                )
00596             adapter.import_(context, 'plugins', False)
00597 
00598             self.assertEqual( plugin.title, None )
00599             self.assertEqual( plugin.cookie_name, COOKIE_NAME )
00600             self.assertEqual( plugin.login_path, LOGIN_PATH )
00601 
    class DomainAuthHelperExportImportTests(_TestBase):

Definition at line 561 of file test_exportimport.py.

00561 
00562         def test_import_with_title(self):
00563             TITLE = 'Plugin Title'
00564             COOKIE_NAME = 'COOKIE_NAME'
00565             LOGIN_PATH = 'LOGIN_PATH'
00566             plugin = self._makePlugin('with_title').__of__(self.root)
00567             adapter = self._makeOne(plugin)
00568 
00569             context = DummyImportContext(plugin)
00570             context._files['plugins/with_title.xml'
00571                           ] = _COOKIE_AUTH_TEMPLATE % (TITLE,
00572                                                        COOKIE_NAME,
00573                                                        LOGIN_PATH,
00574                                                       )
00575             adapter.import_(context, 'plugins', False)
00576 
00577             self.assertEqual( plugin.title, TITLE )
00578             self.assertEqual( plugin.cookie_name, COOKIE_NAME )
00579             self.assertEqual( plugin.login_path, LOGIN_PATH )

Definition at line 485 of file test_exportimport.py.

00485 
00486         def test_listExportableItems(self):
00487             plugin = self._makePlugin('lEI').__of__(self.root)
00488             adapter = self._makeOne(plugin)
00489 
00490             self.assertEqual(len(adapter.listExportableItems()), 0)
00491             plugin.cookie_name = 'COOKIE_NAME'
00492             plugin.login_path = 'LOGIN_PATH'
00493             self.assertEqual(len(adapter.listExportableItems()), 0)


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