Beispiel #1
0
def test_if_none_as_char_gives_0_point():
    pw = '123'
    assert compute_strength(pw) == 0
Beispiel #2
0
def test_password_is_not_isalpha_and_isdigita_gives_0_point():
    pw = '123'
    assert compute_strength(pw) == 0
Beispiel #3
0
def test_password_is_a_special_gives_1_point():
    pw = '#%&+_-'
    assert compute_strength(pw) == 1
Beispiel #4
0
def test_password_is_isalpha_and_isdigita_gives_1_point():
    pw = 'abc1234'
    assert compute_strength(pw) == 1
Beispiel #5
0
def test_password_with_length_11_gives_1_point2():
    pw = '1' * 11
    assert compute_strength(pw) == 1
def test_password_with_special_characters_gives_1_point():
    pw = "#%&+_-"
    assert compute_strength(pw)[0] == 1
Beispiel #7
0
def main():
    pw = input("Skriv ditt löseord: ")
    pwstrength.compute_strength(pw)
def test_password_with_length_3_and_number_letters_and_specialchars_gives_2_point(
):
    pw = "a1&"
    assert compute_strength(pw)[0] == 2
def test_password_with_length_11_and_number_letters_and_gives_2_point():
    pw = "a1" * 11
    assert compute_strength(pw)[0] == 2
def test_password_with_length_11_gives_1_point():
    pw = "1" * 11
    assert compute_strength(pw)[0] == 1
def test_password_with_length_11_and_number_letters_and_specialchars_gives_3_point(
):
    pw = "aaa111&&&&" * 11
    assert compute_strength(pw)[0] == 3
def test_password_with_bad_chars_0_point():
    pw = "!" * 11
    assert compute_strength(pw)[0] == 0
def test_password_empty_gives_0_point():
    pw = ""
    assert compute_strength(pw)[0] == 0
def test_password_with_number_and_letter_gives_1_point():
    pw = "1a"
    assert compute_strength(pw)[0] == 1
Beispiel #15
0
def test_password_with_length_5_gives_5_gives_0_points2():
    pw = "1" * 5
    assert compute_strength(pw) == 0
def test_password_with_length_11_and_specialchars_gives_2_point():
    pw = "&" * 11
    assert compute_strength(pw)[0] == 2
Beispiel #17
0
from uppgift36.pwstrength import compute_strength

if __name__ == '__main__':

    while True:
        password = input("Ange lösenord: ")
        res, passed = compute_strength(password)
        if passed:
            if res == 0:
                print(f"Antal poäng: {res}. Svagt lösenord men godkänt.")
            if res == 1:
                print(f"Antal poäng: {res} Bättre kan du.")
            if res > 1:
                print(f" Antal poäng: {res}. Bra lösenord")
            break
        print("Ogiltigt lösenord! Försök igen :)")




Beispiel #18
0
def main():
    password = input("Choose a password:"******"Ditt lösenord får {pw} poäng!")