-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test_sensorthings.py Fix ref
- Loading branch information
Showing
2 changed files
with
8 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# | ||
# Authors: Benjamin Webb <[email protected]> | ||
# | ||
# Copyright (c) 2022 Benjamin Webb | ||
# Copyright (c) 2024 Benjamin Webb | ||
# | ||
# Permission is hereby granted, free of charge, to any person | ||
# obtaining a copy of this software and associated documentation | ||
|
@@ -48,30 +48,29 @@ def config(): | |
def test_query_datastreams(config): | ||
p = SensorThingsProvider(config) | ||
fields = p.get_fields() | ||
assert len(fields) == 15 | ||
assert len(fields) == 16 | ||
assert fields['Thing']['type'] == 'number' | ||
assert fields['Observations']['type'] == 'number' | ||
assert fields['@iot.id']['type'] == 'number' | ||
assert fields['name']['type'] == 'string' | ||
|
||
kwargs = {'sortby': [{'property': '@iot.id', 'order': '+'}]} | ||
results = p.query(**kwargs) | ||
results = p.query() | ||
assert len(results['features']) == 10 | ||
assert results['numberReturned'] == 10 | ||
assert len(results['features'][0]['properties']['Observations']) == 17 | ||
|
||
assert results['features'][0]['geometry']['coordinates'][0] == -108.7483 | ||
assert results['features'][0]['geometry']['coordinates'][1] == 35.6711 | ||
|
||
results = p.query(limit=1, **kwargs) | ||
results = p.query(limit=1) | ||
assert len(results['features']) == 1 | ||
assert results['features'][0]['id'] == '1' | ||
|
||
results = p.query(offset=2, limit=1, **kwargs) | ||
results = p.query(offset=2, limit=1) | ||
assert len(results['features']) == 1 | ||
assert results['features'][0]['id'] == '3' | ||
|
||
assert len(results['features'][0]['properties']) == 17 | ||
assert len(results['features'][0]['properties']) == 18 | ||
|
||
results = p.query(bbox=[-109, 36, -106, 37]) | ||
assert results['numberReturned'] == 8 | ||
|
@@ -89,6 +88,7 @@ def test_query_datastreams(config): | |
def test_query_observations(config): | ||
config['properties'] = ['Datastream', 'phenomenonTime', | ||
'FeatureOfInterest', 'result'] | ||
config['data'] = 'http://localhost:8888/FROST-Server/v1.1/' | ||
config['entity'] = 'Observations' | ||
p = SensorThingsProvider(config) | ||
|
||
|