99from datetime import datetime
1010import json
1111
12+ from tests.utils import service_ok
13+
1214import pytest
1315
1416from owslib.ogcapi.connectedsystems import Commands, ControlChannels, Datastreams, Deployments, Observations, \
1517 Properties, SamplingFeatures, SystemEvents, SystemHistory, Systems
1618from owslib.util import Authentication
1719
20+ # Directs to OSH (Open Sensor Hub) hosted test server
21+ TEST_URL = 'http://34.67.197.57:8585/sensorhub/api/'
1822
1923@pytest.fixture(scope="session")
2024def fixtures():
2125 class OSHFixtures:
22- NODE_TEST_OK_URL = 'http://34.67.197.57:8585/sensorhub/test'
23- # Directs to OSH hosted test server
24- TEST_URL = 'http://34.67.197.57:8585/sensorhub/api/'
2526 auth = Authentication('auto_test', 'automated_tester24')
2627 sml_headers = {'Content-Type': 'application/sml+json'}
2728 json_headers = {'Content-Type': 'application/json'}
@@ -214,6 +215,7 @@ def delete_all_sampling_features(self):
214215 yield OSHFixtures()
215216
216217
218+ @pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable")
217219class TestSystems:
218220 @pytest.mark.online
219221 def test_system_readonly(self, fixtures):
@@ -255,6 +257,7 @@ def test_system_functions(self, fixtures):
255257 assert res == {}
256258
257259
260+ @pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable")
258261class TestDeployments:
259262 @pytest.mark.skip(reason="Skip transactional test")
260263 def test_deployment_create(self, fixtures):
@@ -279,6 +282,7 @@ def test_deployment_delete(self, fixtures):
279282 assert res is not None
280283
281284
285+ @pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable")
282286class TestSamplingFeatures:
283287 @pytest.mark.online
284288 def test_sampling_features_readonly(self, fixtures):
@@ -324,6 +328,7 @@ def test_sampling_features_all(self, fixtures):
324328 assert res == {'items': []}
325329
326330
331+ @pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable")
327332class TestDatastreams:
328333 @pytest.mark.online
329334 def test_datastreams_readonly(self, fixtures):
@@ -369,6 +374,7 @@ def test_all_ds_functions(self, fixtures):
369374 assert ds_delete == {}
370375
371376
377+ @pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable")
372378class TestObservations:
373379 @pytest.mark.online
374380 def test_observations_readonly(self, fixtures):
@@ -409,6 +415,7 @@ def test_observations(self, fixtures):
409415 fixtures.delete_all_systems()
410416
411417
418+ @pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable")
412419class TestSystemHistory:
413420 @pytest.mark.online
414421 def test_system_history(self, fixtures):
0 commit comments