Add a test case for rand_name with prefix

This commit adds a test case for rand_name with prefix.

Change-Id: If0269d59cf45843cf50f7436df46c063693fb060
This commit is contained in:
Masayuki Igawa
2015-03-25 16:47:28 -04:00
parent 32369dbbf6
commit f4b8c6f133

View File

@@ -48,6 +48,13 @@ class TestDataUtils(base.TestCase):
self.assertTrue(actual.startswith('foo'))
self.assertNotEqual(actual, actual2)
def test_rand_name_with_prefix(self):
actual = data_utils.rand_name(prefix='prefix-str')
self.assertIsInstance(actual, str)
self.assertRegexpMatches(actual, "^prefix-str-")
actual2 = data_utils.rand_name(prefix='prefix-str')
self.assertNotEqual(actual, actual2)
def test_rand_url(self):
actual = data_utils.rand_url()
self.assertIsInstance(actual, str)