def test_nonums(self): rules = pc._rules_dictionary(length=10, must_have_numbers=False, must_have_caps=True) for pw in nonums_passw: with self.subTest(i=pw): self.assertTrue(pc.password_check(pw, rules))
def test_strong(self): rules = pc._rules_dictionary(length=20) for pw in strong_passw: with self.subTest(i=pw): self.assertFalse(pc.password_check(pw, rules))
def test_superlong(self): rules = pc._rules_dictionary(length=20) self.assertTrue(pc.password_check('Aabcdvwxyz101abcdewxyzZ', rules))
def test_short(self): rules = pc._rules_dictionary(length=4) for pw in short_passw: with self.subTest(i=pw): self.assertTrue(pc.password_check(pw, rules))
def test_supershort(self): rules = pc._rules_dictionary(length=4) self.assertFalse(pc.password_check('ab1', rules))
def test_nonums(self): rules = pc._rules_dictionary() for pw in nonums_passw: with self.subTest(i=pw): self.assertFalse(pc.password_check(pw, rules))
def wrapped_password_check(): password = request.get_json()['password'] result = password_check(password, _rules_dictionary()) return jsonify(result)