def test_separator(self): passp = Passphrase() for wrongtype in constants.WRONGTYPES_STR: with self.assertRaises(TypeError) as context: passp.separator = wrongtype self.assertIn('separator can only be string', str(context.exception))
def test_separator(self): passp = Passphrase('internal') passp.amount_w = 1 passp.amount_n = 1 passp.separator = '-.-' passp.generate() self.assertIn('-.-', str(passp))
def test_generate_uuid4(self): passp = Passphrase() passphrase = passp.generate_uuid4() self.assertIsInstance(passphrase, list) self.assertEqual(len(passphrase), 5) passp.separator = '' uuid4 = UUID(str(passp), version=4) self.assertEqual(str(passp), uuid4.hex)
def test_password_use_digits(self): passp = Passphrase() passp.separator = '' passp.passwordlen = 5 passp.password_use_lowercase = False passp.password_use_uppercase = False passp.password_use_digits = True passp.password_use_punctuation = False passp.generate_password() self.assertRegex(str(passp), r'[\d]+')
def test_password_use_punctuation(self): passp = Passphrase() passp.separator = '' passp.passwordlen = 5 passp.password_use_lowercase = False passp.password_use_uppercase = False passp.password_use_digits = False passp.password_use_punctuation = True passp.generate_password() self.assertRegex( str(passp), r'[\!\"\#\$\%\&\\\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\]\^\_' r'\`\{\|\}\~]+')