Skip to content

Commit

Permalink
Add fix for #9
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Oct 11, 2024
1 parent 95f3873 commit c0ae2d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ schemathesis~=3.34
pytest~=8.3
shapely~=2.0
requests~=2.32.0
urllib3~=2.2.0
21 changes: 13 additions & 8 deletions sedr/schemat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from shapely.wkt import loads as wkt_loads
import pytest
import requests
import urllib.parse

import util
import edreq11 as edreq
Expand All @@ -20,8 +21,7 @@
schema = None
extents = {}
collection_ids = {}
# TODO: rodeo always enabled for testing. Remove.
rodeo = True
rodeo = False


def set_up_schemathesis(args):
Expand Down Expand Up @@ -78,14 +78,22 @@ def after_call(context, case, response):
)


@schema.include(path_regex="^" + util.args.base_path + "conformance").parametrize()
@schema.include(
path_regex="^" + urllib.parse.urljoin(util.args.base_path, "/conformance")
).parametrize()
@settings(max_examples=util.args.iterations, deadline=None)
def test_edr_conformance(case):
"""Test /conformance endpoint."""
global rodeo
response = case.call()
conformance_json = json.loads(response.text)

if (
util.args.rodeo_profile
or rodeoprofile.conformance_url in conformance_json["conformsTo"]
):
rodeo = True

if "conformsTo" not in conformance_json:
spec_ref = "https://docs.ogc.org/is/19-072/19-072.html#_4129e3d3-9428-4e91-9bfc-645405ed2369"
raise AssertionError(
Expand All @@ -99,7 +107,7 @@ def test_edr_conformance(case):
raise AssertionError(resolves_message)

requirementA2_2_A5, requirementA2_2_A5_message = edreq.requirementA2_2_A5(
jsondata=conformance_json["conformsTo"]
jsondata=conformance_json["conformsTo"], siteurl=util.args.url
)
if not requirementA2_2_A5:
raise AssertionError(requirementA2_2_A5_message)
Expand All @@ -116,9 +124,6 @@ def test_edr_conformance(case):
if not requirementA11_1:
raise AssertionError(requirementA11_1_message)

if rodeoprofile.conformance_url in conformance_json["conformsTo"]:
rodeo = True

if rodeo:
requirement7_1, requirement7_1_message = rodeoprofile.requirement7_1(
jsondata=conformance_json["conformsTo"]
Expand Down Expand Up @@ -157,7 +162,7 @@ def test_edr_landingpage(case):
raise AssertionError(requirement7_2_message)


@schema.include(path_regex="^" + util.args.base_path + "collections$").parametrize()
@schema.include(path_regex="^" + urllib.parse.urljoin(util.args.base_path, "collections$")).parametrize()
@settings(max_examples=util.args.iterations, deadline=None)
def test_edr_collections(case):
"""The default testing in function test_api() will fuzz the collections. This function will test that collections contain EDR spesifics. It will also require /collections to exist, in accordance with Requirement A.2.2 A.9
Expand Down

0 comments on commit c0ae2d3

Please sign in to comment.