Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFUid.tests.test_uidgeneration.UniqueIdGeneratorToolTests Class Reference
Inheritance diagram for CMFUid.tests.test_uidgeneration.UniqueIdGeneratorToolTests:
Inheritance graph
[legend]
Collaboration diagram for CMFUid.tests.test_uidgeneration.UniqueIdGeneratorToolTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_z3interfaces
def test_returnedUidsAreValidAndDifferent
def test_converter
def test_migrationFromBTreeLengthToInteger

Private Member Functions

def _getTargetClass

Detailed Description

Definition at line 26 of file test_uidgeneration.py.


Member Function Documentation

Definition at line 28 of file test_uidgeneration.py.

00028 
00029     def _getTargetClass(self):
00030         from Products.CMFUid.UniqueIdGeneratorTool \
00031                 import UniqueIdGeneratorTool
00032 
00033         return UniqueIdGeneratorTool

Definition at line 34 of file test_uidgeneration.py.

00034 
00035     def setUp(self):
00036         SecurityTest.setUp(self)
00037         self.root._setObject('portal_uidgenerator', self._getTargetClass()())

Definition at line 51 of file test_uidgeneration.py.

00051 
00052     def test_converter(self):
00053         generator = self.root.portal_uidgenerator
00054         uid = generator()
00055         str_uid = str(uid)
00056         result = generator.convert(str_uid)
00057         self.assertEqual(result, uid)

Definition at line 58 of file test_uidgeneration.py.

00058 
00059     def test_migrationFromBTreeLengthToInteger(self):
00060         # For backwards compatibility with CMF 1.5.0 and 1.5.1, check if
00061         # the generator correctly replaces a ``BTree.Length.Length`` object
00062         # to an integer.
00063         generator = self.root.portal_uidgenerator
00064         uid1 = generator()
00065         generator._uid_counter = Length(uid1)
00066         self.failUnless(isinstance(generator._uid_counter, Length))
00067         uid2 = generator()
00068         self.failUnless(isinstance(generator._uid_counter, int))
00069         self.failIfEqual(uid1, uid2)
00070 

Definition at line 44 of file test_uidgeneration.py.

00044 
00045     def test_returnedUidsAreValidAndDifferent(self):
00046         generator = self.root.portal_uidgenerator
00047         uid1 = generator()
00048         uid2 = generator()
00049         self.failIfEqual(uid1, uid2)
00050         self.failIfEqual(uid1, None)

Definition at line 38 of file test_uidgeneration.py.

00038 
00039     def test_z3interfaces(self):
00040         from zope.interface.verify import verifyClass
00041         from Products.CMFUid.interfaces import IUniqueIdGenerator
00042 
00043         verifyClass(IUniqueIdGenerator, self._getTargetClass())


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