コード例 #1
0
def test_check_password_strengh_at_least_one_uppercase():
    field = FakeField("longenoughpasswordbutnouppercase78")
    with assert_raises(ValidationError) as e:
        check_password_strengh(None, field)

    assert_equal(e.exception.args[0],
                 "Weak password: Missing at least 1 uppercase character")
コード例 #2
0
def test_check_password_strengh_at_least_one_lowercase():
    field = FakeField("LONGENOUGHPASSWORDBUTNOLOWERCASE78")
    with assert_raises(ValidationError) as e:
        check_password_strengh(None, field)

    assert_equal(e.exception.args[0],
                 "Weak password: Missing at least 1 lowercase character")
コード例 #3
0
def test_check_password_strengh_ok():
    field = FakeField("aSpecialPassword2018!")
    try:
        check_password_strengh(None, field)
    except Exception as e:
        raise e
    else:
        pass
コード例 #4
0
def test_check_password_strengh_at_least_one_special_symbol():
    field = FakeField("LongEnoughP4ssW0rdButN0Speci4l")
    with assert_raises(ValidationError) as e:
        check_password_strengh(None, field)

    assert_equal(
        e.exception.args[0],
        "Weak password: Missing at least 1 special symbol (eg. !@#$%^&*.)")
コード例 #5
0
def test_check_password_strengh_length():
    field = FakeField("shrtpwd")
    with assert_raises(ValidationError) as e:
        check_password_strengh(None, field)

    assert_equal(e.exception.args[0], "Weak password: Length inferior to 8")