コード例 #1
0
 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))
コード例 #2
0
 def test_separator(self):
     passp = Passphrase('internal')
     passp.amount_w = 1
     passp.amount_n = 1
     passp.separator = '-.-'
     passp.generate()
     self.assertIn('-.-', str(passp))
コード例 #3
0
 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)
コード例 #4
0
 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]+')
コード例 #5
0
 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'\`\{\|\}\~]+')