Skip to content

Commit

Permalink
feat(sensor): add id field(dump_only) to schema and response json
Browse files Browse the repository at this point in the history
Signed-off-by: GustaafL <guus@seita.nl>
  • Loading branch information
GustaafL committed Aug 2, 2023
1 parent c039fb9 commit c094558
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion flexmeasures/api/v3_0/tests/test_sensors_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ def test_patch_sensor(client, setup_api_test_data):

@pytest.mark.parametrize(
"attribute, value",
[("generic_asset_id", 8), ("entity_address", "ea1.2025-01.io.flexmeasures:fm1.1")],
[
("generic_asset_id", 8),
("entity_address", "ea1.2025-01.io.flexmeasures:fm1.1"),
("id", 7),
],
)
def test_patch_sensor_for_excluded_attribute(
client, setup_api_test_data, attribute, value
Expand Down
1 change: 1 addition & 0 deletions flexmeasures/data/schemas/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Meta:
model = Asset
"""

id = ma.auto_field(dump_only=True)
name = ma.auto_field(required=True)
unit = ma.auto_field(required=True)
timezone = ma.auto_field()
Expand Down

0 comments on commit c094558

Please sign in to comment.