示例#1
0
def test_password_from_html_vars_change_pw(request_context):
    html.request.set_var(
        "pw_orig",
        base64.b64encode(Encrypter.encrypt("abc")).decode("ascii"))
    html.request.set_var("pw", "xyz")
    pw = vs.Password()
    assert pw.from_html_vars("pw") == "xyz"
示例#2
0
def test_password_from_html_vars_change_pw(request_context):
    html.request.set_var("pw_orig", vs.ValueEncrypter.encrypt("abc"))
    html.request.set_var("pw", "xyz")
    pw = vs.Password()
    assert pw.from_html_vars("pw") == "xyz"
示例#3
0
def test_password_from_html_vars_initial_pw(request_context):
    html.request.set_var("pw_orig", "")
    html.request.set_var("pw", "abc")
    pw = vs.Password()
    assert pw.from_html_vars("pw") == "abc"
示例#4
0
def test_password_from_html_vars_not_set(request_context):
    pw = vs.Password()
    assert pw.from_html_vars("pw") == ""
示例#5
0
def test_password_from_html_vars_empty(request_context):
    html.request.set_var("pw_orig", "")
    html.request.set_var("pw", "")

    pw = vs.Password()
    assert pw.from_html_vars("pw") == ""
示例#6
0
def test_password_from_html_vars_unchanged_pw(register_builtin_html):
    html.request.set_var("pw_orig", vs.ValueEncrypter.encrypt("abc"))
    html.request.set_var("pw", "")
    pw = vs.Password()
    assert pw.from_html_vars("pw") == "abc"
示例#7
0
def test_password_from_html_vars_not_set(register_builtin_html):
    pw = vs.Password()
    assert pw.from_html_vars("pw") == ""
示例#8
0
def test_password_from_html_vars_empty(register_builtin_html):
    html.request.set_var("pw_orig", "")
    html.request.set_var("pw", "")

    pw = vs.Password()
    assert pw.from_html_vars("pw") == ""