From 52b96e7b45bd3528bcf66e18b4f1491655597775 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Thu, 29 Dec 2011 17:23:27 +0000 Subject: Ensure generated passwords meet minimum complexity Windows has a complexity requirement of at least three of these criteria: - one or more upper case characters - one or more lower case characters - one or more numbers - one or more special characters In some cases, the passwords generated didn't meet three of these four critera. This change enforces that three of these criteria will be met in the generated passwords. Change-Id: Ibe0055b8830b426aee1c9b722cc2fae2f5db4c5c --- nova/tests/test_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py index 513461dcc..92376f1f2 100644 --- a/nova/tests/test_utils.py +++ b/nova/tests/test_utils.py @@ -360,6 +360,14 @@ class GenericUtilsTestCase(test.TestCase): self.mox.UnsetStubs() self.assertEqual(data, fake_contents) + def test_generate_password(self): + password = utils.generate_password() + self.assertTrue([c for c in password if c in '0123456789']) + self.assertTrue([c for c in password + if c in 'abcdefghijklmnopqrstuvwxyz']) + self.assertTrue([c for c in password + if c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']) + class IsUUIDLikeTestCase(test.TestCase): def assertUUIDLike(self, val, expected): -- cgit