|
2 | 2 | # |
3 | 3 | # Authors: Benjamin Webb <bwebb@lincolninst.edu> |
4 | 4 | # |
5 | | -# Copyright (c) 2022 Benjamin Webb |
| 5 | +# Copyright (c) 2024 Benjamin Webb |
6 | 6 | # |
7 | 7 | # Permission is hereby granted, free of charge, to any person |
8 | 8 | # obtaining a copy of this software and associated documentation |
@@ -138,3 +138,27 @@ def test_get(config): |
138 | 138 | assert result['id'] == '9' |
139 | 139 | assert result['properties']['name'] == 'Depth Below Surface' |
140 | 140 | assert isinstance(result['properties']['Thing'], dict) |
| 141 | + |
| 142 | + |
| 143 | +def test_custom_expand(config): |
| 144 | + p = SensorThingsProvider(config) |
| 145 | + fields = p.get_fields() |
| 146 | + assert 'Observations' in fields |
| 147 | + assert 'ObservedProperty' in fields |
| 148 | + assert 'Sensor' in fields |
| 149 | + |
| 150 | + config['expand'] = 'Thing/Locations' |
| 151 | + p = SensorThingsProvider(config) |
| 152 | + fields = p.get_fields() |
| 153 | + assert len(fields) == 12 |
| 154 | + assert 'Observations' not in fields |
| 155 | + assert 'ObservedProperty' not in fields |
| 156 | + assert 'Sensor' not in fields |
| 157 | + |
| 158 | + config['expand'] = 'Thing/Locations,Observations' |
| 159 | + p = SensorThingsProvider(config) |
| 160 | + fields = p.get_fields() |
| 161 | + assert len(fields) == 14 |
| 162 | + assert 'Observations' in fields |
| 163 | + assert 'ObservedProperty' not in fields |
| 164 | + assert 'Sensor' not in fields |
0 commit comments