Do not use $ in regex

$ has been deleted in password, so it also needs to be deleted in
regex.
Associated Change-Id: Iebb211165c4deee09d34e19b5557a3e086add05a
           review link: https://review.openstack.org/#/c/346800/

Change-Id: I4e3196c26d81cf359686537d02550434b0b0e559
This commit is contained in:
guo yunxian 2016-07-29 10:06:52 +08:00
parent 4522829c98
commit 9996555875

View File

@ -59,7 +59,7 @@ class TestDataUtils(base.TestCase):
def test_rand_password(self): def test_rand_password(self):
actual = data_utils.rand_password() actual = data_utils.rand_password()
self.assertIsInstance(actual, str) self.assertIsInstance(actual, str)
self.assertRegex(actual, "[A-Za-z0-9~!@#$%^&*_=+]{15,}") self.assertRegex(actual, "[A-Za-z0-9~!@#%^&*_=+]{15,}")
actual2 = data_utils.rand_password() actual2 = data_utils.rand_password()
self.assertNotEqual(actual, actual2) self.assertNotEqual(actual, actual2)
@ -67,7 +67,7 @@ class TestDataUtils(base.TestCase):
actual = data_utils.rand_password(8) actual = data_utils.rand_password(8)
self.assertIsInstance(actual, str) self.assertIsInstance(actual, str)
self.assertEqual(len(actual), 8) self.assertEqual(len(actual), 8)
self.assertRegex(actual, "[A-Za-z0-9~!@#$%^&*_=+]{8}") self.assertRegex(actual, "[A-Za-z0-9~!@#%^&*_=+]{8}")
actual2 = data_utils.rand_password(8) actual2 = data_utils.rand_password(8)
self.assertNotEqual(actual, actual2) self.assertNotEqual(actual, actual2)
@ -75,7 +75,7 @@ class TestDataUtils(base.TestCase):
actual = data_utils.rand_password(2) actual = data_utils.rand_password(2)
self.assertIsInstance(actual, str) self.assertIsInstance(actual, str)
self.assertEqual(len(actual), 3) self.assertEqual(len(actual), 3)
self.assertRegex(actual, "[A-Za-z0-9~!@#$%^&*_=+]{3}") self.assertRegex(actual, "[A-Za-z0-9~!@#%^&*_=+]{3}")
actual2 = data_utils.rand_password(2) actual2 = data_utils.rand_password(2)
self.assertNotEqual(actual, actual2) self.assertNotEqual(actual, actual2)