mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-06-12 05:23:43 +03:00
Rename __json__() to asdict()
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user