morethantext-web/tests/step_defs/test_session.py

26 lines
588 B
Python
Raw Normal View History

2022-06-22 12:03:17 -04:00
"""tests for server sessions."""
from pytest_bdd import given, scenarios, then, when
scenarios("../features/session.feature")
@given("a running server")
def start_server(server):
"""Make a running server."""
server.set_safe_port()
server.start()
@when("the home page is accessed")
def access_home_page(server, page):
"""Access the home page."""
url = f"http://{server.base_url}/"
page.request_url(url)
@then("there is a session id")
def confirm_session(page):
"""Confirm session id exists."""
2022-06-23 14:09:03 -04:00
assert len(page.get_cookies()), "No cookies received."