Last active
May 13, 2022 07:27
-
-
Save twyle/9bf4b1967247da3d484d51d2bf39520c to your computer and use it in GitHub Desktop.
Testing the home route.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""This module tests the home route.""" | |
def test_home(client): | |
"""Tests that the home route returns ok message on GET request. | |
GIVEN we have the /api/v1 route | |
WHEN we send a GET request | |
THEN we should get a 200 OK response | |
""" | |
resp = client.get('/api/v1') | |
assert resp.status_code == 200 | |
def test_home_bad_http_method(client): | |
"""Tests that the home route returns method not allowed message on POST request. | |
GIVEN we have the /api/v1 route | |
WHEN we send a POST request | |
THEN we should get a 405 error code in the response | |
""" | |
resp = client.post('/api/v1') | |
assert resp.status_code == 405 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment