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.
43 lines
1.4 KiB
43 lines
1.4 KiB
def test_registration_procedure(testapp, login_as, parse_latest_mail): |
|
response = testapp.get("/", status=302).follow(status=200) |
|
assert "Please Log In" in response |
|
|
|
response = testapp.get("/registration", status=200) |
|
assert "Register a new account" in response |
|
|
|
form = response.form |
|
form["user_name"] = "TestNew" |
|
form["first_name"] = "Eric" |
|
form["last_name"] = "Idle" |
|
form["email"] = "eric@example.com" |
|
form["password"] = "eric" |
|
response = form.submit("Create account").follow() |
|
assert "The account needs to be activated" in response |
|
|
|
response = login_as("TestNew", "eric") |
|
assert "Credentials are invalid" in response |
|
|
|
login_as("TestAdmin", "jane") |
|
|
|
response = testapp.get("/users/?role=new", status=200) |
|
assert "TestNew" in response |
|
|
|
response = testapp.get("/users/TestNew/edit", status=200) |
|
assert "Edit User" in response |
|
|
|
form = response.forms[1] |
|
form["role"].select(text="User") |
|
response = form.submit("Save changes").follow() |
|
assert "TestNew" in response |
|
|
|
response = testapp.get("/users/?role=new", status=200) |
|
assert "TestNew" not in response |
|
|
|
response = testapp.get("/users/?role=user", status=200) |
|
assert "TestNew" in response |
|
|
|
parsed = parse_latest_mail() |
|
assert "Your account was activated" in parsed.body |
|
|
|
response = login_as("TestNew", "eric").follow() |
|
assert "My Orders" in response
|
|
|