Esempio n. 1
0
 def testAnalysis(self):
     """Test that main() runs and returns the correct analysis object."""
     result = pass_check.main("0000000000")
     self.assertEqual(result.word, "0000000000")
     self.assertGreater(result.cost, 1)
     self.assertEqual(result.parts[0].word, "0000000000")
     self.assertEqual(result.parts[0].type, "repetition")
     self.assertGreater(result.time, 0)
Esempio n. 2
0
 def testPatternWordCombination(self):
     """Test that combinations of words are identified."""
     result = pass_check.main("wordthreat")
     self.assertGreater(result.cost, 1)
     self.assertEqual(result.parts[0].word, "word")
     self.assertEqual(result.parts[0].pattern, "word-combination")
     self.assertEqual(result.parts[1].word, "threat")
     self.assertEqual(result.parts[1].pattern, "word-combination")
Esempio n. 3
0
 def testPatternWordRepeat(self):
     """Test that repeated words are identified."""
     result = pass_check.main("timertimer")
     self.assertGreater(result.cost, 1)
     self.assertEqual(result.parts[0].word, "timer")
     self.assertEqual(result.parts[0].pattern, "word-repeat")
     self.assertEqual(result.parts[1].word, "timer")
     self.assertEqual(result.parts[1].pattern, "word-repeat")
Esempio n. 4
0
 def testRandomPassword(self):
     """Test that main() runs and returns a valid analysis object."""
     result = pass_check.main(randomPassword=True)
     self.assertTrue(bool(result.word))
     self.assertGreater(result.cost, 1)
     self.assertTrue(bool(result.parts[0].word))
     self.assertTrue(bool(result.parts[0].type))
     self.assertTrue(bool(result.word))
Esempio n. 5
0
 def testPatternBorderMirror(self):
     """Test that a mirrored border is identified: ((example))"""
     result = pass_check.main("((mirrors))")
     self.assertGreater(result.cost, 1)
     self.assertEqual(result.parts[0].word, "((")
     self.assertEqual(result.parts[0].pattern, "border-mirror")
     self.assertEqual(result.parts[1].word, "mirrors")
     self.assertEqual(result.parts[1].pattern, None)
     self.assertEqual(result.parts[2].word, "))")
     self.assertEqual(result.parts[2].pattern, "border-mirror")
Esempio n. 6
0
 def testPatternBorderRepeat(self):
     """Test that a repeated border is identified: !!example!!"""
     result = pass_check.main("!!borders!!")
     self.assertGreater(result.cost, 1)
     self.assertEqual(result.parts[0].word, "!!")
     self.assertEqual(result.parts[0].pattern, "border-repeat")
     self.assertEqual(result.parts[1].word, "borders")
     self.assertEqual(result.parts[1].pattern, None)
     self.assertEqual(result.parts[2].word, "!!")
     self.assertEqual(result.parts[2].pattern, "border-repeat")
Esempio n. 7
0
 def testPatternWordCombinationDelimiter(self):
     """Test that two words with a single delimiter are identified."""
     result = pass_check.main("money$dollars")
     self.assertGreater(result.cost, 1)
     self.assertEqual(result.parts[0].word, "money")
     self.assertEqual(result.parts[0].pattern, "word-combination")
     self.assertEqual(result.parts[1].word, "$")
     self.assertEqual(result.parts[1].pattern, "word-combination-delimiter")
     self.assertEqual(result.parts[2].word, "dollars")
     self.assertEqual(result.parts[2].pattern, "word-combination")
Esempio n. 8
0
 def testTime(self):
     """Test random passwords, fail if any time is greater than 1"""
     for i in range(0, 20):
         result = pass_check.main(randomPassword=True)
         self.assertLess(result.time, 1)