Exemplo n.º 1
0
    def test_length_8_lowercase_digits_3(self):
        '''
        Complexity 3: password has length >= 8 chars and only lowercase and digits
        '''
        from password import check_password_level, make_password

        assert check_password_level(make_password(8, 2)) == 3
        assert check_password_level(make_password(8, 2) + 'AAAAA') == 3
Exemplo n.º 2
0
    def test_lowercase_digits_uppercase_punctuation_4(self):
        '''
        Complexity 4: Previous levels condition and at least 1 punctuation
        '''
        from password import check_password_level, make_password

        assert check_password_level(make_password(7, 4)) == 4
        assert check_password_level(make_password(80, 4)) == 4
Exemplo n.º 3
0
    def test_lowercase_digits_2(self):
        '''
        Complexity 2: Previous level condition and at least 1 digit
        '''
        from password import check_password_level, make_password

        assert check_password_level(make_password(7, 2)) == 2
        assert check_password_level(make_password(7, 2) + 'AAA') != 2
Exemplo n.º 4
0
    def test_length_8_lowercase_2(self):
        '''
        Complexity 2: password has length >= 8 chars and only lowercase chars
        '''
        from password import check_password_level, make_password

        assert check_password_level(make_password(8, 1)) == 2
        assert check_password_level(make_password(80, 1)) == 2
Exemplo n.º 5
0
    def test_lowercase_digits_uppercase_3(self):
        '''
        Complexity 3: Previous levels condition and at least 1 uppercase char
        '''
        from password import check_password_level, make_password

        assert check_password_level(make_password(8, 3)) == 3
        assert check_password_level(make_password(80, 3)) == 3
        assert check_password_level(make_password(8, 3) + '}{') != 3
Exemplo n.º 6
0
    def test_only_lowercase_1(self):
        '''
        Complexity 1: If password has only lowercase chars
        '''
        from password import check_password_level, make_password

        assert check_password_level(make_password(7, 1)) == 1
        assert check_password_level(make_password(8, 1)) != 1
        assert check_password_level(make_password(7, 1) + '123') != 1
Exemplo n.º 7
0
    def test_complexity_one(self):
        '''
        Complexity 1: only lowercase chars
        Complexity 2: Previous level plus at least 1 digit
        Complexity 3: Previous levels plus at least 1 uppercase char
        Complexity 4: Previous levels plus at least 1 punctuation char
        '''
        from password import make_password

        assert make_password(7, 1)
Exemplo n.º 8
0
 def set_password(self, raw_password):
     self.password = password.make_password(raw_password)
Exemplo n.º 9
0
def get_password(event):
    password, salt, length = split_entry(event.widget.get())
    root.clipboard_clear()
    root.clipboard_append(make_password(password, salt, length))
    root.update()
    root.withdraw()
Exemplo n.º 10
0
def get_password(event):
    password, salt, length = split_entry(event.widget.get())
    root.clipboard_clear()
    root.clipboard_append(make_password(password, salt, length))
    root.update()
    root.withdraw()
Exemplo n.º 11
0
 def test_password_length_equal_10(self):
     self.assertEqual(10, len(make_password("password", "facebook")))
Exemplo n.º 12
0
 def test_password_hash(self):
     self.assertEqual('MjE5Y2I1OG', make_password("password", "facebook"))
Exemplo n.º 13
0
 def test_password_length_can_change(self):
     self.assertEqual(4, len(make_password("password", "facebook", 4)))