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")
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")
def test_check_password_strengh_ok():
    field = FakeField("aSpecialPassword2018!")
    try:
        check_password_strengh(None, field)
    except Exception as e:
        raise e
    else:
        pass
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. !@#$%^&*.)")
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")