Added integration testing.
This commit is contained in:
25
tests/step_defs/test_server_start.py
Normal file
25
tests/step_defs/test_server_start.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Interpratures for server start features."""
|
||||
|
||||
from pytest_bdd import given, scenarios, then, when
|
||||
|
||||
scenarios("../features/server_start.feature")
|
||||
|
||||
@given("a server")
|
||||
def create_server(server):
|
||||
"""Set up a server."""
|
||||
|
||||
@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.settings['address']}:{server.settings['port']}/"
|
||||
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
|
||||
Reference in New Issue
Block a user