42 lines
945 B
Python
42 lines
945 B
Python
"""Interpratures for server start features."""
|
|
|
|
from pytest_bdd import given, scenarios, then, when
|
|
|
|
scenarios("../features/server_start.feature")
|
|
|
|
|
|
@given("a server")
|
|
def create_server():
|
|
"""Set up a server."""
|
|
|
|
|
|
@given("environment variables are used")
|
|
def set_use_environment(server):
|
|
"""Sets up the process for environment variables."""
|
|
server.use_config = False
|
|
|
|
|
|
@given("port is changed to something different")
|
|
def set_to_safe_port(server):
|
|
"""Set the app server to an unused port."""
|
|
server.set_safe_port()
|
|
|
|
|
|
@given("it is running")
|
|
def start_server(server):
|
|
"""Start up the server."""
|
|
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("the status should be OK")
|
|
def check_for_ok(page):
|
|
"""Is the page status code 200"""
|
|
assert page.get_status_code() == 200
|