morethantext-web/tests/step_defs/test_session.py

26 lines
588 B
Python

"""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."""
assert len(page.get_cookies()), "No cookies received."