2020-12-20 21:12:13 +01:00
|
|
|
import pytest
|
2021-01-14 13:12:59 +01:00
|
|
|
from falcon import testing
|
2020-12-20 21:12:13 +01:00
|
|
|
|
|
|
|
from dspace_statistics_api.app import api
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def client():
|
|
|
|
return testing.TestClient(api)
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_docs(client):
|
|
|
|
"""Test requesting the documentation at the root."""
|
|
|
|
|
|
|
|
response = client.simulate_get("/")
|
|
|
|
|
|
|
|
assert isinstance(response.content, bytes)
|
|
|
|
assert response.status_code == 200
|
2020-12-22 10:18:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_openapi_json(client):
|
|
|
|
"""Test requesting the OpenAPI JSON schema."""
|
|
|
|
|
|
|
|
response = client.simulate_get("/docs/openapi.json")
|
|
|
|
|
|
|
|
assert isinstance(response.content, bytes)
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_swagger_ui(client):
|
|
|
|
"""Test requesting the Swagger UI."""
|
|
|
|
|
|
|
|
response = client.simulate_get("/swagger")
|
|
|
|
|
|
|
|
assert isinstance(response.content, bytes)
|
|
|
|
assert response.status_code == 200
|
2020-12-22 10:30:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_status(client):
|
|
|
|
"""Test requesting the status page."""
|
|
|
|
|
|
|
|
response = client.simulate_get("/status")
|
|
|
|
|
|
|
|
assert isinstance(response.content, bytes)
|
|
|
|
assert response.status_code == 200
|
2020-12-24 12:11:12 +01:00
|
|
|
|
2020-12-24 12:12:06 +01:00
|
|
|
|
2020-12-24 12:11:12 +01:00
|
|
|
# vim: set sw=4 ts=4 expandtab:
|