Our custom ordering system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

85 lines
2.7 KiB

def test_my_account_edit(testapp, login_as):
response = testapp.get("/", status=302).follow(status=200)
assert "Please Log In" in response
response = login_as("TestUser", "jon").follow(status=200)
assert "My Orders" in response
response = testapp.get("/myaccount")
form = response.forms[1]
form["first_name"] = "Terry"
form["last_name"] = "Gilliam"
form["email"] = "terry@example.com"
form.submit("Save_Changes")
login_as("TestAdmin", "jane")
response = testapp.get("/users/", status=200)
assert "Jon" not in response
assert "Smith" not in response
assert "jon@example.com" not in response
assert "Terry" in response
assert "Gilliam" in response
assert "terry@example.com" in response
def test_my_account_edit_cancel(testapp, login_as):
response = testapp.get("/", status=302).follow(status=200)
assert "Please Log In" in response
response = login_as("TestUser", "jon").follow(status=200)
assert "My Orders" in response
response = testapp.get("/myaccount")
form = response.forms[1]
form["first_name"] = "Terry"
form["last_name"] = "Gilliam"
form["email"] = "terry@example.com"
form.submit("Cancel")
login_as("TestAdmin", "jane")
response = testapp.get("/users/", status=200)
assert "Jon" in response
assert "Smith" in response
assert "jon@example.com" in response
assert "Terry" not in response
assert "Gilliam" not in response
assert "terry@example.com" not in response
def test_my_account_edit_form_error(testapp, login_as):
response = testapp.get("/", status=302).follow(status=200)
assert "Please Log In" in response
response = login_as("TestUser", "jon").follow(status=200)
assert "My Orders" in response
response = testapp.get("/myaccount")
form = response.forms[1]
form["first_name"] = ""
form["last_name"] = ""
form["email"] = ""
response = form.submit("Save_Changes")
assert "There was a problem with your submission" in response
def test_my_account_reset_password(testapp, login_as, parse_latest_mail):
response = testapp.get("/", status=302).follow(status=200)
assert "Please Log In" in response
response = login_as("TestUser", "jon").follow(status=200)
assert "My Orders" in response
response = testapp.get("/myaccount")
assert "Change Password" in response
response = testapp.get("/mypassword").follow().follow()
assert "My Orders" in response
assert "A password reset link has been sent" in response
parsed = parse_latest_mail()
assert "If you forgot your password" in parsed.body
# same link target as forgotten password, rest is tested there
assert parsed.link.startswith("http://localhost/reset?t=")