Rename __json__() to asdict()

This commit is contained in:
grossmj
2021-04-17 23:34:28 +09:30
parent 2c7de627f7
commit bc14f15a61
4 changed files with 7 additions and 7 deletions

View File

@@ -239,14 +239,14 @@ class ComputeManager(QtCore.QObject):
for c in computes:
if c.id() == compute_id and c != self._computes[compute_id]:
log.debug("Update compute %s", compute_id)
self._controller.put("/computes" + compute_id, None, body=c.__json__())
self._controller.put("/computes" + compute_id, None, body=c.asdict())
self._computes[compute_id] = c
self.updated_signal.emit(compute_id)
# Create the new nodes
for compute in computes:
if compute.id() not in self._computes:
log.debug("Create compute %s", compute.id())
self._controller.post("/computes", None, body=compute.__json__())
self._controller.post("/computes", None, body=compute.asdict())
self._computes[compute.id()] = compute
self.created_signal.emit(compute.id())

View File

@@ -69,7 +69,7 @@ class TemplateManager(QtCore.QObject):
"""
log.debug("Create template '{}' (ID={})".format(template.name(), template.id()))
self._controller.post("/templates", callback, body=template.__json__())
self._controller.post("/templates", callback, body=template.asdict())
def deleteTemplate(self, template_id):
"""
@@ -105,7 +105,7 @@ class TemplateManager(QtCore.QObject):
"""
log.debug("Update template '{}' (ID={})".format(template.name(), template.id()))
self._controller.put("/templates/{template_id}".format(template_id=template.id()), None, body=template.__json__())
self._controller.put("/templates/{template_id}".format(template_id=template.id()), None, body=template.asdict())
def updateList(self, templates):
"""

View File

@@ -41,8 +41,8 @@ def test_fromSvg(image, project):
def test_json(image):
image._hash_svg = None
assert "svg" in image.__json__()
assert "svg" in image.asdict()
# If we call the function twice and the svg didn't change we don't send the modification
assert "svg" not in image.__json__()
assert "svg" not in image.asdict()

View File

@@ -156,7 +156,7 @@ def test_updateList_updated(controller):
compute.setName("TEST2")
cm.updateList(computes)
assert cm._computes["test1"].name() == "TEST2"
controller._http_client.createHTTPQuery.assert_called_with("PUT", "/computes/test1", None, body=compute.__json__())
controller._http_client.createHTTPQuery.assert_called_with("PUT", "/computes/test1", None, body=compute.asdict())
def test_updateList_added(controller):