Skip to content

Commit

Permalink
Adapt ci oss and formatting of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzsommer committed May 29, 2024
1 parent 4ef11e4 commit b0923df
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 18 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os:
- ubuntu-latest
- ubuntu-22.04
- ubuntu-20.04
- windows-latest
- windows-2022
- windows-2019
- macos-latest
- macos-12
- macos-11

steps:
- name: Checkout code
Expand All @@ -26,4 +35,4 @@ jobs:
run: pip install -r requirements.txt

- name: Run Python Tests
run: python -m unittest discover
run: python -m unittest discover
49 changes: 33 additions & 16 deletions test/test_resolving_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,53 @@ def run_server_context():
class TestSemanticMatchingService(unittest.TestCase):

def test_semantic_matching_service_iri(self):
# TODO deposit DNS record
with run_server_context():
sms_request = SMSRequest(semantic_id="foo://example.org:1234/over/there?name=bar#page=3")
response = requests.get("http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json())
self.assertEqual("https://example.org/fallback_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"])
response = requests.get(
"http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json()
)
self.assertEqual(
"https://example.org/fallback_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"]
)

def test_semantic_matching_service_irdi_eclass(self):
with run_server_context():
sms_request = SMSRequest(semantic_id="0173-1#01-ACK323#017")
response = requests.get("http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json())
self.assertEqual("https://example.org/eclass_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"])
response = requests.get(
"http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json()
)
self.assertEqual(
"https://example.org/eclass_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"]
)

def test_semantic_matching_service_irdi_cdd(self):
with run_server_context():
sms_request = SMSRequest(semantic_id="0112-1#01-ACK323#017")
response = requests.get("http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json())
self.assertEqual("https://example.org/cdd_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"])
response = requests.get(
"http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json()
)
self.assertEqual(
"https://example.org/cdd_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"]
)

def test_semantic_matching_service_fallback(self):
with run_server_context():
sms_request = SMSRequest(semantic_id="nothing")
response = requests.get("http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json())
self.assertEqual("https://example.org/fallback_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"])
response = requests.get(
"http://localhost:8125/get_semantic_matching_service",
data=sms_request.model_dump_json()
)
self.assertEqual(
"https://example.org/fallback_semantic_matching_service",
response.json()["semantic_matching_service_endpoint"]
)

# TODO check debug endpoints

Expand Down

0 comments on commit b0923df

Please sign in to comment.