Browse Source

add one more test for input

oz123 11 years ago
parent
commit
389a2260ef
2 changed files with 6 additions and 1 deletions
  1. 5 0
      pwman/tests/db_tests.py
  2. 1 1
      pwman/ui/cli.py

+ 5 - 0
pwman/tests/db_tests.py

@@ -117,3 +117,8 @@ class CLITests(unittest.TestCase):
     def test_input(self):
         name = self.tester.cli.get_username(reader=lambda: 'alice')
         self.assertEqual(name, 'alice')
+
+    def test_password(self):
+        password = self.tester.cli.get_password(None,
+                                                reader=lambda x: 'hatman')
+        self.assertEqual(password, 'hatman')

+ 1 - 1
pwman/ui/cli.py

@@ -113,7 +113,7 @@ class PwmanCliOld(cmd.Cmd, HelpUI, BaseUI):
             return password
         # no args given
         password = tools.getpassword("Password (Blank to generate): ",
-                                     tools._defaultwidth, False)
+                                     tools._defaultwidth, False, reader)
         if not password:
             length = tools.getinput("Password length (default 7): ", "7")
             if length: