Skip to content

Commit 3098c73

Browse files
authored
Skip connected systems tests if the server is unavailable (#1019)
1 parent 96092c1 commit 3098c73

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_ogcapi_connectedsystems_osh.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
from datetime import datetime
1010
import json
1111

12+
from tests.utils import service_ok
13+
1214
import pytest
1315

1416
from owslib.ogcapi.connectedsystems import Commands, ControlChannels, Datastreams, Deployments, Observations, \
1517
Properties, SamplingFeatures, SystemEvents, SystemHistory, Systems
1618
from 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")
2024
def 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")
217219
class 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")
258261
class 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")
282286
class 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")
327332
class 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")
372378
class 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")
412419
class TestSystemHistory:
413420
@pytest.mark.online
414421
def test_system_history(self, fixtures):

0 commit comments

Comments
 (0)