Ejemplo n.º 1
0
class LengthFactorTest(TestCase):
    def setUp(self):
        self.factor = LengthFactor(length=8)
        super(LengthFactorTest, self).setUp()

    def test_length(self):
        last_score = -1
        for i in range(self.factor.length):
            score, _ = self.factor.test('a' * (i + 1))
            assert score > last_score
            last_score = score

        score, feedback = self.factor._test('a' * self.factor.length)
        assert score == 1.0

        for i in range(self.factor.length, self.factor.length + 10):
            score, feedback = self.factor.test('a' * (i + 1))
            assert score > last_score
            last_score = score
Ejemplo n.º 2
0
def test(value):
    from pwdmeter import NonASCIIFactor, NonDictionaryFactor, LengthFactor, VarietyFactor, CasemixFactor, CharmixFactor
    m = Meter([
        NonDictionaryFactor(),
        NonASCIIFactor(),
        LengthFactor(),
        VarietyFactor(),
        CasemixFactor(),
        CharmixFactor()
    ])
    return m.test(value)
Ejemplo n.º 3
0
 def setUp(self):
     self.m = Meter([
         NonDictionaryFactor(),
         NonASCIIFactor(),
         LengthFactor(),
         VarietyFactor(),
         CasemixFactor(),
         CharmixFactor()
     ])
     self.threshold = self.m.threshold
     super(MeterTest, self).setUp()
Ejemplo n.º 4
0
class LengthFactorTest(TestCase):

    def setUp(self):
        self.factor = LengthFactor(length=8)
        super(LengthFactorTest, self).setUp()

    def test_length(self):
        last_score = -1
        for i in range(self.factor.length):
            score, _ = self.factor.test('a' * (i + 1))
            assert score > last_score
            last_score = score

        score, feedback = self.factor._test('a' * self.factor.length)
        assert score == 1.0

        for i in range(self.factor.length, self.factor.length + 10):
            score, feedback = self.factor.test('a' * (i + 1))
            assert score > last_score
            last_score = score
Ejemplo n.º 5
0
 def setUp(self):
     self.factor = LengthFactor(length=8)
     super(LengthFactorTest, self).setUp()
Ejemplo n.º 6
0
 def setUp(self):
     self.factor = LengthFactor(length=8)
     super(LengthFactorTest, self).setUp()