ia64/xen-unstable

view tools/python/xen/xend/tests/test_uuid.py @ 8145:b7790c2874c4

Fix test following uuid format change in changeset 8089.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Wed Nov 30 19:48:21 2005 +0000 (2005-11-30)
parents c24fae1cd39d
children edeeddb1bbf9
line source
1 import unittest
3 from xen.xend import uuid
6 class test_uuid(unittest.TestCase):
8 def testStringRoundtrip(self):
9 def t(inp):
10 self.assertEqual(uuid.fromString(uuid.toString(inp)), inp)
12 t(uuid.create())
13 t(uuid.create())
14 t(uuid.create())
15 t(uuid.create())
16 t(uuid.create())
19 def testToFromString(self):
20 def t(inp, expected):
21 self.assertEqual(uuid.toString(inp), expected)
22 self.assertEqual(uuid.fromString(expected), inp)
24 t([0 for _ in range(0, 16)], "00000000-00000000-00000000-00000000")
25 t([185, 158, 125, 206, 250, 178, 125, 57, 2, 6, 162, 74, 178, 236,
26 196, 5], "b99e7dce-fab27d39-0206a24a-b2ecc405")
29 def test_suite():
30 return unittest.makeSuite(test_uuid)