Commit 6fb4c73e authored by Vincent Pelletier's avatar Vincent Pelletier

Make getNewUUID a function so it can be reused without requiring to inherint from the whole class.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1138 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 5953febf
......@@ -49,6 +49,14 @@ DB_ADMIN = 'root'
DB_PASSWD = None
DB_USER = 'test'
def getNewUUID():
""" Return a valid UUID """
uuid = protocol.INVALID_UUID
while uuid == protocol.INVALID_UUID:
uuid = os.urandom(16)
self.uuid = uuid
return uuid
class NeoTestBase(unittest.TestCase):
""" Base class for neo tests, implements common checks """
......@@ -108,12 +116,7 @@ class NeoTestBase(unittest.TestCase):
# XXX: according to changes with namespaced UUIDs, it would be better to
# implement get<NodeType>UUID() methods
def getNewUUID(self):
""" Return a valid UUID """
uuid = protocol.INVALID_UUID
while uuid == protocol.INVALID_UUID:
uuid = os.urandom(16)
self.uuid = uuid
return uuid
return getNewUUID()
def getTwoIDs(self):
""" Return a tuple of two sorted UUIDs """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment