Skip to content
Snippets Groups Projects
Commit 67656662 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][editors] Don't return empty description in json dump

The field is optional
parent e5a69b2b
No related branches found
No related tags found
1 merge request!71Implement ProtocolTemplateEditor
......@@ -109,10 +109,7 @@ class TestMockEditor:
field.format_name = "value32"
field.format_type = "float32"
assert widget.dump_json() == {
"field": {"value32": "float32"},
"description": "",
}
assert widget.dump_json() == {"field": {"value32": "float32"}}
qtbot.mouseClick(widget.add_field_button, QtCore.Qt.LeftButton)
fields = widget.findChildren(FieldWidget)
......@@ -125,6 +122,5 @@ class TestMockEditor:
field.format_type = "float64"
assert widget.dump_json() == {
"field": {"value32": "float32", "value64": "float64"},
"description": "",
"field": {"value32": "float32", "value64": "float64"}
}
......@@ -152,7 +152,11 @@ class AbstractAssetEditor(QWidget):
def dump_json(self):
"""Returns the json representation of the asset"""
json_data = {"description": self.description_lineedit.text()}
json_data = {}
description = self.description_lineedit.text()
if description:
json_data["description"] = description
json_data.update(self._dump_json())
return json_data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment