def test_character_set(self): s = PasswordSetting("unit.test") self.assertFalse(s.use_custom_character_set()) self.assertEqual("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + "#!\"§$%&/()[]{}=-_+*<>;:.", s.get_character_set()) s.set_custom_character_set("&=Oo0wWsS$#uUvVzZ") self.assertTrue(s.use_custom_character_set()) self.assertEqual("&=Oo0wWsS$#uUvVzZ", s.get_character_set()) s.set_custom_character_set( "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + "#!\"§$%&/()[]{}=-_+*<>;:.") self.assertFalse(s.use_custom_character_set()) self.assertEqual("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + "#!\"§$%&/()[]{}=-_+*<>;:.", s.get_character_set()) s.set_use_letters(False) self.assertEqual("0123456789#!\"§$%&/()[]{}=-_+*<>;:.", s.get_character_set()) s.set_use_letters(True) s.set_use_digits(False) s.set_use_extra(False) self.assertEqual("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", s.get_character_set())
def test_set_use_digits(self): s = PasswordSetting("unit.test") s.set_custom_character_set("abE;c2") s.set_use_digits(False) self.assertEqual("abcE;", s.get_character_set()) s.set_custom_character_set("aL;^bc2") s.set_use_digits(True) self.assertEqual("abcL0123456789;^", s.get_character_set())