Revision d242923c test/ganeti.utils.text_unittest.py
b/test/ganeti.utils.text_unittest.py | ||
---|---|---|
356 | 356 |
|
357 | 357 |
class TestNormalizeAndValidateMac(unittest.TestCase): |
358 | 358 |
def testInvalid(self): |
359 |
self.assertRaises(errors.OpPrereqError,
|
|
360 |
utils.NormalizeAndValidateMac, "xxx")
|
|
359 |
for i in ["xxx", "00:11:22:33:44:55:66", "zz:zz:zz:zz:zz:zz"]:
|
|
360 |
self.assertRaises(errors.OpPrereqError, utils.NormalizeAndValidateMac, i)
|
|
361 | 361 |
|
362 | 362 |
def testNormalization(self): |
363 | 363 |
for mac in ["aa:bb:cc:dd:ee:ff", "00:AA:11:bB:22:cc"]: |
364 | 364 |
self.assertEqual(utils.NormalizeAndValidateMac(mac), mac.lower()) |
365 | 365 |
|
366 | 366 |
|
367 |
class TestNormalizeAndValidateThreeOctetMacPrefix(unittest.TestCase): |
|
368 |
def testInvalid(self): |
|
369 |
for i in ["xxx", "00:11:22:33:44:55:66", "zz:zz:zz:zz:zz:zz", |
|
370 |
"aa:bb:cc:dd:ee:ff", "00:AA:11:bB:22:cc", |
|
371 |
"00:11:"]: |
|
372 |
self.assertRaises(errors.OpPrereqError, |
|
373 |
utils.NormalizeAndValidateThreeOctetMacPrefix, i) |
|
374 |
|
|
375 |
def testNormalization(self): |
|
376 |
for mac in ["aa:bb:cc", "00:AA:11"]: |
|
377 |
self.assertEqual(utils.NormalizeAndValidateThreeOctetMacPrefix(mac), |
|
378 |
mac.lower()) |
|
379 |
|
|
380 |
|
|
367 | 381 |
class TestSafeEncode(unittest.TestCase): |
368 | 382 |
"""Test case for SafeEncode""" |
369 | 383 |
|
Also available in: Unified diff