Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
kupu.plone.tests.test_resourcetypemapper.TestIResourceTypeMapper Class Reference
Inheritance diagram for kupu.plone.tests.test_resourcetypemapper.TestIResourceTypeMapper:
Inheritance graph
[legend]
Collaboration diagram for kupu.plone.tests.test_resourcetypemapper.TestIResourceTypeMapper:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def prepare
def test_get_portal_types
def test_update
def test_delete

Public Attributes

 portal
 type_map

Detailed Description

Test the implementation of IResourceMapper in KupuLibraryTool

Definition at line 39 of file test_resourcetypemapper.py.


Member Function Documentation

Definition at line 42 of file test_resourcetypemapper.py.

00042 
00043     def afterSetUp(self):
00044         self.portal = FakePortal()
00045         self.type_map = self.prepare()

Definition at line 46 of file test_resourcetypemapper.py.

00046 
00047     def prepare(self):
00048         type_map = KupuLibraryTool()
00049         type_map = type_map.__of__(self.portal)
00050         type_map.addResourceType("foobar", ("Foo", "", "Bar"))
00051         type_map.addResourceType("bonobo", ("Monkey", " Ape\n"))
00052         return type_map

Definition at line 76 of file test_resourcetypemapper.py.

00076 
00077     def test_delete(self):
00078         type_map = self.type_map
00079         type_map.deleteResourceTypes(["foobar", "bonobo"])
00080         self.assertRaises(KeyError, type_map.getPortalTypesForResourceType,
00081                           "foobar")
00082         self.assertRaises(KeyError, type_map.getPortalTypesForResourceType,
00083                           "bonobo")

Definition at line 53 of file test_resourcetypemapper.py.

00053 
00054     def test_get_portal_types(self):
00055         type_map = self.type_map
00056         self.assertEqual(type_map.getPortalTypesForResourceType("foobar"),
00057                          ("Foo", "Bar"))
00058         self.assertEqual(type_map.getPortalTypesForResourceType("bonobo"),
00059                          ("Monkey", "Ape"))

Definition at line 60 of file test_resourcetypemapper.py.

00060 
00061     def test_update(self):
00062         type_map = self.type_map
00063         type_info = [
00064             dict(old_type='foobar', resource_type='foobar',
00065                  portal_types=("Nothing In Here Anymore",)),
00066             dict(old_type='bonobo', resource_type='chimpanse',
00067                  portal_types=("Bad Monkey", "Bad Ape")),
00068             ]
00069         type_map.updateResourceTypes(type_info)
00070         self.assertEqual(type_map.getPortalTypesForResourceType("foobar"),
00071                          ("Nothing In Here Anymore",))
00072         self.assertEqual(type_map.getPortalTypesForResourceType("chimpanse"),
00073                          ("Bad Monkey", "Bad Ape"))
00074         self.assertRaises(KeyError, type_map.getPortalTypesForResourceType,
00075                           "bonobo")

Here is the call graph for this function:


Member Data Documentation

Definition at line 43 of file test_resourcetypemapper.py.

Definition at line 44 of file test_resourcetypemapper.py.


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