summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2011-12-29 17:23:27 +0000
committerJohannes Erdfelt <johannes.erdfelt@rackspace.com>2011-12-29 19:38:24 +0000
commit52b96e7b45bd3528bcf66e18b4f1491655597775 (patch)
tree92a607638345b7b332aa41af7b745ade1198aaef /nova/tests
parent783ac027f934b25e225619f9cf2cf26814fd7da6 (diff)
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
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_utils.py8
1 files changed, 8 insertions, 0 deletions
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):