Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFDiffTool.tests.testDiffTool.TestDiffTool Class Reference
Inheritance diagram for CMFDiffTool.tests.testDiffTool.TestDiffTool:
Inheritance graph
Collaboration diagram for CMFDiffTool.tests.testDiffTool.TestDiffTool:
Collaboration graph

List of all members.

Public Member Functions

def afterSetUp
def testInterface
def testRegisterDiffType
def testSetDiff
def testSetDiffReplaces
def testSingleSetDiffField
def testMultipleSetDiffField
def testReplaceSetDiffField
def testSetDiffFieldNameFailure
def testSetDiffFieldBlankFieldFailure
def testSetDiffFieldInvalidDiffFailure
def beforeTearDown

Public Attributes


Detailed Description

Test the portal_diff tool

Definition at line 15 of file

Member Function Documentation

Definition at line 18 of file

00019     def afterSetUp(self):
00020         self.p_diff = self.portal.portal_diff
00021         registerDiffType(DummyDiff)

Definition at line 78 of file

00079     def beforeTearDown(self):
00080         # Undo changes that don't get rolled back (i.e. module level changes)
00081         unregisterDiffType(DummyDiff)

Here is the call graph for this function:

Ensure that tool instances implement the portal_diff interface

Definition at line 22 of file

00023     def testInterface(self):
00024         """Ensure that tool instances implement the portal_diff interface"""
00025         from Products.CMFDiffTool.interfaces.portal_diff import portal_diff
00026         self.failUnless(portal_diff.isImplementedBy(self.p_diff))

Test setDiffField method adding a second field to one content type

Definition at line 53 of file

00054     def testMultipleSetDiffField(self):
00055         """Test setDiffField method adding a second field to one content type"""
00056         self.p_diff.setDiffField('Document', 'title', 'Dummy Diff Type')
00057         self.p_diff.setDiffField('Document', 'description', 'Dummy Diff Type')
00058         d = {'title':'Dummy Diff Type', 'description':'Dummy Diff Type'}
00059         self.failUnless(self.p_diff.getDiffForPortalType('Document') == d)

Test registration of Diff types

Definition at line 27 of file

00028     def testRegisterDiffType(self):
00029         """Test registration of Diff types"""
00030         unregisterDiffType(DummyDiff)
00031         self.failIf('Dummy Diff Type' in self.p_diff.listDiffTypes())
00032         registerDiffType(DummyDiff)
00033         self.failUnless('Dummy Diff Type' in self.p_diff.listDiffTypes())

Here is the call graph for this function:

Test that setDiffField does a replace for existing fields

Definition at line 60 of file

00061     def testReplaceSetDiffField(self):
00062         """Test that setDiffField does a replace for existing fields"""
00063         registerDiffType(DummyDiff2)
00064         self.p_diff.setDiffField('Document', 'title', 'Dummy Diff Type')
00065         self.p_diff.setDiffField('Document', 'title', 'Second Dummy Diff Type')
00066         d = {'title':'Second Dummy Diff Type'}
00067         self.failUnless(self.p_diff.getDiffForPortalType('Document') == d)
00068         unregisterDiffType(DummyDiff2)

Here is the call graph for this function:

Test setDiffForPortalType() method

Definition at line 34 of file

00035     def testSetDiff(self):
00036         """Test setDiffForPortalType() method"""
00037         d = {'field1':'TestDiff', 'field2':'Dummy Diff Type'}
00038         self.p_diff.setDiffForPortalType('Document', d)
00039         self.failUnless(self.p_diff.getDiffForPortalType('Document') == d)

Definition at line 72 of file

00073     def testSetDiffFieldBlankFieldFailure(self):
00074         self.assertRaises('BadRequest', self.p_diff.setDiffField, 'Document', '', 'Dummy Diff Type')

Definition at line 75 of file

00076     def testSetDiffFieldInvalidDiffFailure(self):
00077         self.assertRaises('BadRequest', self.p_diff.setDiffField, 'Document', 'title', 'NoDiff')

Definition at line 69 of file

00070     def testSetDiffFieldNameFailure(self):
00071         self.assertRaises('BadRequest', self.p_diff.setDiffField, 'Bob', 'title', 'Dummy Diff Type')

Test that setDiffForPortalType() replaces old data

Definition at line 40 of file

00041     def testSetDiffReplaces(self):
00042         """Test that setDiffForPortalType() replaces old data"""
00043         d1 = {'field1':'TestDiff', 'field2':'Dummy Diff Type'}
00044         d2 = {'field3':'Dummy Diff Type'}
00045         self.p_diff.setDiffForPortalType('Document', d1)
00046         self.p_diff.setDiffForPortalType('Document', d2)
00047         self.failUnless(self.p_diff.getDiffForPortalType('Document') == d2)

Test setDiffField method

Definition at line 48 of file

00049     def testSingleSetDiffField(self):
00050         """Test setDiffField method"""
00051         self.p_diff.setDiffField('Document', 'title', 'Dummy Diff Type')
00052         self.failUnless(self.p_diff.getDiffForPortalType('Document') == {'title':'Dummy Diff Type'})

Member Data Documentation

Definition at line 19 of file

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