def test_gen_password(self, getpass): """ Generate a password """ passwds = ['foo', 'foo', 'bar', 'baz'] getpass.getpass.side_effect = passwds.pop ret = scripts._gen_password() self.assertEqual(len(passwds), 0) self.assertTrue(pwd_context.verify('foo', ret))
def test_gen_password(self, getpass): """ Generate a password """ pwd_context = get_pwd_context() passwds = ["foo", "foo", "bar", "baz"] getpass.getpass.side_effect = passwds.pop ret = scripts._gen_password() self.assertEqual(len(passwds), 0) self.assertTrue(pwd_context.verify("foo", ret))