mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Rename __json__() to asdict()
This commit is contained in:
1 parent
44074ff7c9
commit
cefab8d362
89 files changed
+286
-282
No files matched your search
@@ -121,7 +121,7 @@ async def test_compute_httpQueryAuth(compute):
|
||||
# mock.assert_any_call("POST", "https://example.com:84/v2/compute/projects", data=b'{"a": "b"}', headers={'content-type': 'application/json'}, auth=None, chunked=None, timeout=20)
|
||||
# #assert compute._connected
|
||||
# assert compute._capabilities["version"] == __version__
|
||||
# controller.notification.controller_emit.assert_called_with("compute.updated", compute.__json__())
|
||||
# controller.notification.controller_emit.assert_called_with("compute.updated", compute.asdict())
|
||||
# await compute.close()
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ async def test_compute_httpQueryAuth(compute):
|
||||
# assert controller.gns3vm.start.called
|
||||
# #assert compute._connected
|
||||
# assert compute._capabilities["version"] == __version__
|
||||
# controller.notification.controller_emit.assert_called_with("compute.updated", compute.__json__())
|
||||
# controller.notification.controller_emit.assert_called_with("compute.updated", compute.asdict())
|
||||
# await compute.close()
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ async def test_compute_httpQuery_project(compute):
|
||||
response.status = 200
|
||||
project = Project(name="Test")
|
||||
await compute.post("/projects", project)
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=json.dumps(project.__json__()), headers={'content-type': 'application/json'}, auth=None, chunked=None, timeout=20)
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=json.dumps(project.asdict()), headers={'content-type': 'application/json'}, auth=None, chunked=None, timeout=20)
|
||||
await compute.close()
|
||||
|
||||
# FIXME: https://github.com/aio-libs/aiohttp/issues/2525
|
||||
@@ -298,7 +298,7 @@ async def test_compute_httpQuery_project(compute):
|
||||
async def test_json(compute):
|
||||
|
||||
compute.user = "test"
|
||||
assert compute.__json__() == {
|
||||
assert compute.asdict() == {
|
||||
"compute_id": "my_compute_id",
|
||||
"name": compute.name,
|
||||
"protocol": "https",
|
||||
@@ -319,7 +319,7 @@ async def test_json(compute):
|
||||
"node_types": []
|
||||
}
|
||||
}
|
||||
assert compute.__json__(topology_dump=True) == {
|
||||
assert compute.asdict(topology_dump=True) == {
|
||||
"compute_id": "my_compute_id",
|
||||
"name": compute.name,
|
||||
"protocol": "https",
|
||||
@@ -358,7 +358,7 @@ async def test_update(compute, controller):
|
||||
await compute.update(name="Test 2")
|
||||
assert compute.name == "Test 2"
|
||||
assert compute.host == "example.org"
|
||||
controller.notification.controller_emit.assert_called_with("compute.updated", compute.__json__())
|
||||
controller.notification.controller_emit.assert_called_with("compute.updated", compute.asdict())
|
||||
assert compute.connected is False
|
||||
assert compute._controller.save.called
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ from gns3server.version import __version__
|
||||
# data = json.load(f)
|
||||
# assert data["version"] == __version__
|
||||
# assert data["iou_license"] == controller.iou_license
|
||||
# assert data["gns3vm"] == controller.gns3vm.__json__()
|
||||
# assert data["gns3vm"] == controller.gns3vm.asdict()
|
||||
#
|
||||
#
|
||||
# def test_load_controller_settings(controller, controller_config_path):
|
||||
@@ -115,10 +115,10 @@ async def test_add_compute(controller):
|
||||
|
||||
controller._notification = MagicMock()
|
||||
c = await controller.add_compute(compute_id="test1", connect=False)
|
||||
controller._notification.controller_emit.assert_called_with("compute.created", c.__json__())
|
||||
controller._notification.controller_emit.assert_called_with("compute.created", c.asdict())
|
||||
assert len(controller.computes) == 1
|
||||
await controller.add_compute(compute_id="test1", connect=False)
|
||||
controller._notification.controller_emit.assert_called_with("compute.updated", c.__json__())
|
||||
controller._notification.controller_emit.assert_called_with("compute.updated", c.asdict())
|
||||
assert len(controller.computes) == 1
|
||||
await controller.add_compute(compute_id="test2", connect=False)
|
||||
assert len(controller.computes) == 2
|
||||
@@ -156,7 +156,7 @@ async def test_deleteComputeProjectOpened(controller, controller_config_path):
|
||||
c._connected = True
|
||||
await controller.delete_compute("test1")
|
||||
assert len(controller.computes) == 0
|
||||
controller._notification.controller_emit.assert_called_with("compute.deleted", c.__json__())
|
||||
controller._notification.controller_emit.assert_called_with("compute.deleted", c.asdict())
|
||||
assert c.connected is False
|
||||
|
||||
# Project 1 use this compute it should be close before deleting the compute
|
||||
@@ -383,12 +383,12 @@ def test_appliances(controller, config, tmpdir):
|
||||
controller.appliance_manager.load_appliances()
|
||||
assert len(controller.appliance_manager.appliances) > 0
|
||||
for appliance in controller.appliance_manager.appliances.values():
|
||||
assert appliance.__json__()["status"] != "broken"
|
||||
assert "Alpine Linux" in [c.__json__()["name"] for c in controller.appliance_manager.appliances.values()]
|
||||
assert "My Appliance" in [c.__json__()["name"] for c in controller.appliance_manager.appliances.values()]
|
||||
assert appliance.asdict()["status"] != "broken"
|
||||
assert "Alpine Linux" in [c.asdict()["name"] for c in controller.appliance_manager.appliances.values()]
|
||||
assert "My Appliance" in [c.asdict()["name"] for c in controller.appliance_manager.appliances.values()]
|
||||
|
||||
for c in controller.appliance_manager.appliances.values():
|
||||
j = c.__json__()
|
||||
j = c.asdict()
|
||||
if j["name"] == "Alpine Linux":
|
||||
assert j["builtin"]
|
||||
elif j["name"] == "My Appliance":
|
||||
|
||||
@@ -47,7 +47,7 @@ def test_init_with_uuid(project):
|
||||
def test_json(project):
|
||||
|
||||
i = Drawing(project, None, svg="<svg></svg>")
|
||||
assert i.__json__() == {
|
||||
assert i.asdict() == {
|
||||
"drawing_id": i.id,
|
||||
"project_id": project.id,
|
||||
"x": i.x,
|
||||
@@ -57,7 +57,7 @@ def test_json(project):
|
||||
"svg": i.svg,
|
||||
"rotation": i.rotation
|
||||
}
|
||||
assert i.__json__(topology_dump=True) == {
|
||||
assert i.asdict(topology_dump=True) == {
|
||||
"drawing_id": i.id,
|
||||
"x": i.x,
|
||||
"y": i.y,
|
||||
|
||||
@@ -66,7 +66,7 @@ async def test_list(controller):
|
||||
async def test_json(controller):
|
||||
|
||||
vm = GNS3VM(controller)
|
||||
assert vm.__json__() == vm._settings
|
||||
assert vm.asdict() == vm._settings
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not working well on Windows")
|
||||
|
||||
@@ -81,7 +81,7 @@ async def test_add_node(project, compute):
|
||||
await link.add_node(node2, 0, 4)
|
||||
|
||||
assert link.create.called
|
||||
link._project.emit_notification.assert_called_with("link.created", link.__json__())
|
||||
link._project.emit_notification.assert_called_with("link.created", link.asdict())
|
||||
assert link in node2.links
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ async def test_json(project, compute):
|
||||
link.create = AsyncioMagicMock()
|
||||
await link.add_node(node1, 0, 4)
|
||||
await link.add_node(node2, 1, 3)
|
||||
assert link.__json__() == {
|
||||
assert link.asdict() == {
|
||||
"link_id": link.id,
|
||||
"project_id": project.id,
|
||||
"nodes": [
|
||||
@@ -228,7 +228,7 @@ async def test_json(project, compute):
|
||||
"capture_file_path": None,
|
||||
"capture_compute_id": None
|
||||
}
|
||||
assert link.__json__(topology_dump=True) == {
|
||||
assert link.asdict(topology_dump=True) == {
|
||||
"link_id": link.id,
|
||||
"nodes": [
|
||||
{
|
||||
@@ -267,7 +267,7 @@ async def test_json_serial_link(project, compute):
|
||||
link.create = AsyncioMagicMock()
|
||||
await link.add_node(node1, 0, 4)
|
||||
await link.add_node(node2, 1, 3)
|
||||
assert link.__json__()["link_type"] == "serial"
|
||||
assert link.asdict()["link_type"] == "serial"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -297,7 +297,7 @@ async def test_start_capture(link):
|
||||
await link.start_capture(capture_file_name="test.pcap")
|
||||
assert link._capturing
|
||||
assert link._capture_file_name == "test.pcap"
|
||||
link._project.emit_notification.assert_called_with("link.updated", link.__json__())
|
||||
link._project.emit_notification.assert_called_with("link.updated", link.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -307,7 +307,7 @@ async def test_stop_capture(link):
|
||||
link._project.emit_notification = MagicMock()
|
||||
await link.stop_capture()
|
||||
assert link._capturing is False
|
||||
link._project.emit_notification.assert_called_with("link.updated", link.__json__())
|
||||
link._project.emit_notification.assert_called_with("link.updated", link.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -112,7 +112,7 @@ async def test_eq(compute, project, node, controller):
|
||||
|
||||
def test_json(node, compute):
|
||||
|
||||
assert node.__json__() == {
|
||||
assert node.asdict() == {
|
||||
"compute_id": str(compute.id),
|
||||
"project_id": node.project.id,
|
||||
"node_id": node.id,
|
||||
@@ -153,7 +153,7 @@ def test_json(node, compute):
|
||||
]
|
||||
}
|
||||
|
||||
assert node.__json__(topology_dump=True) == {
|
||||
assert node.asdict(topology_dump=True) == {
|
||||
"compute_id": str(compute.id),
|
||||
"node_id": node.id,
|
||||
"template_id": None,
|
||||
@@ -327,7 +327,7 @@ async def test_update(node, compute, project, controller):
|
||||
assert node._console == 2048
|
||||
assert node.x == 42
|
||||
assert node._properties == {"startup_script": "echo test"}
|
||||
#controller._notification.emit.assert_called_with("node.updated", node.__json__())
|
||||
#controller._notification.emit.assert_called_with("node.updated", node.asdict())
|
||||
assert project.dump.called
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ async def test_update_properties(node, compute, controller):
|
||||
|
||||
# The notif should contain the old properties because it's the compute that will emit
|
||||
# the correct info
|
||||
#node_notif = copy.deepcopy(node.__json__())
|
||||
#node_notif = copy.deepcopy(node.asdict())
|
||||
#node_notif["properties"]["startup_script"] = "echo test"
|
||||
#controller._notification.emit.assert_called_with("node.updated", node_notif)
|
||||
|
||||
@@ -373,7 +373,7 @@ async def test_update_only_controller(node, compute):
|
||||
await node.update(x=42)
|
||||
assert not compute.put.called
|
||||
assert node.x == 42
|
||||
node._project.emit_notification.assert_called_with("node.updated", node.__json__())
|
||||
node._project.emit_notification.assert_called_with("node.updated", node.asdict())
|
||||
|
||||
# If nothing change a second notif should not be sent
|
||||
node._project.emit_notification = AsyncioMagicMock()
|
||||
|
||||
@@ -45,7 +45,7 @@ def test_list_ports(node):
|
||||
List port by default
|
||||
"""
|
||||
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "Ethernet0",
|
||||
"short_name": "e0",
|
||||
@@ -63,7 +63,7 @@ def test_list_ports_vpcs(node):
|
||||
"""
|
||||
|
||||
node._node_type = "vpcs"
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "Ethernet0",
|
||||
"short_name": "e0",
|
||||
@@ -82,7 +82,7 @@ def test_list_ports_docker(node):
|
||||
|
||||
node._node_type = "docker"
|
||||
node._properties["adapters"] = 2
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "eth0",
|
||||
"short_name": "eth0",
|
||||
@@ -110,26 +110,26 @@ def test_list_ports_port_name_format(node):
|
||||
node._first_port_name = None
|
||||
node._port_name_format = "eth{}"
|
||||
node._list_ports()
|
||||
assert node.__json__()["ports"][0]["name"] == "eth0"
|
||||
assert node.asdict()["ports"][0]["name"] == "eth0"
|
||||
node._port_name_format = "eth{port0}"
|
||||
node._list_ports()
|
||||
assert node.__json__()["ports"][0]["name"] == "eth0"
|
||||
assert node.asdict()["ports"][0]["name"] == "eth0"
|
||||
node._port_name_format = "eth{port1}"
|
||||
node._list_ports()
|
||||
assert node.__json__()["ports"][0]["name"] == "eth1"
|
||||
assert node.asdict()["ports"][0]["name"] == "eth1"
|
||||
|
||||
node._first_port_name = ""
|
||||
node._port_segment_size = 2
|
||||
node._port_name_format = "eth{segment0}/{port0}"
|
||||
node.properties["adapters"] = 8
|
||||
node._list_ports()
|
||||
assert node.__json__()["ports"][6]["name"] == "eth3/0"
|
||||
assert node.__json__()["ports"][7]["name"] == "eth3/1"
|
||||
assert node.asdict()["ports"][6]["name"] == "eth3/0"
|
||||
assert node.asdict()["ports"][7]["name"] == "eth3/1"
|
||||
|
||||
node._first_port_name = "mgnt0"
|
||||
node._list_ports()
|
||||
assert node.__json__()["ports"][0]["name"] == "mgnt0"
|
||||
assert node.__json__()["ports"][1]["name"] == "eth0/0"
|
||||
assert node.asdict()["ports"][0]["name"] == "mgnt0"
|
||||
assert node.asdict()["ports"][1]["name"] == "eth0/0"
|
||||
|
||||
|
||||
def test_list_ports_adapters(node):
|
||||
@@ -138,7 +138,7 @@ def test_list_ports_adapters(node):
|
||||
"""
|
||||
|
||||
node.properties["adapters"] = 2
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "Ethernet0",
|
||||
"short_name": "e0",
|
||||
@@ -175,7 +175,7 @@ def test_list_ports_adapters_cloud(project, compute):
|
||||
}
|
||||
]
|
||||
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "eth0",
|
||||
"short_name": "eth0",
|
||||
@@ -206,7 +206,7 @@ def test_list_ports_ethernet_hub(project, compute):
|
||||
}
|
||||
]
|
||||
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "Ethernet0",
|
||||
"short_name": "e0",
|
||||
@@ -238,7 +238,7 @@ def test_list_ports_atm_switch(project, compute):
|
||||
"1:0:100": "10:0:200"
|
||||
}
|
||||
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "1",
|
||||
"short_name": "1",
|
||||
@@ -271,7 +271,7 @@ def test_list_ports_frame_relay_switch(project, compute):
|
||||
"2:102": "11:203"
|
||||
}
|
||||
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "1",
|
||||
"short_name": "1",
|
||||
@@ -317,7 +317,7 @@ def test_list_ports_iou(compute, project):
|
||||
node_type="iou")
|
||||
node.properties["serial_adapters"] = 2
|
||||
node.properties["ethernet_adapters"] = 3
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "Ethernet0/0",
|
||||
"short_name": "e0/0",
|
||||
@@ -526,7 +526,7 @@ def test_list_ports_dynamips(project, compute):
|
||||
node.properties["wic0"] = "WIC-2T"
|
||||
node.properties["wic1"] = "WIC-2T"
|
||||
|
||||
assert node.__json__()["ports"] == [
|
||||
assert node.asdict()["ports"] == [
|
||||
{
|
||||
"name": "FastEthernet0/0",
|
||||
"short_name": "f0/0",
|
||||
|
||||
@@ -126,4 +126,4 @@ def test_various_notification(controller, node):
|
||||
notif.project_emit("log.info", {"message": "Image uploaded"})
|
||||
notif.project_emit("log.warning", {"message": "Warning ASA 8 is not officially supported by GNS3"})
|
||||
notif.project_emit("log.error", {"message": "Permission denied on /tmp"})
|
||||
notif.project_emit("node.updated", node.__json__())
|
||||
notif.project_emit("node.updated", node.asdict())
|
||||
@@ -59,7 +59,7 @@ async def test_json():
|
||||
|
||||
p = Project(name="Test")
|
||||
|
||||
assert p.__json__() == {
|
||||
assert p.asdict() == {
|
||||
"name": "Test",
|
||||
"project_id": p.id,
|
||||
"path": p.path,
|
||||
@@ -90,7 +90,7 @@ async def test_update(controller):
|
||||
assert project.name == "Hello"
|
||||
await project.update(name="World")
|
||||
assert project.name == "World"
|
||||
project.emit_notification.assert_any_call("project.updated", project.__json__())
|
||||
project.emit_notification.assert_any_call("project.updated", project.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -180,7 +180,7 @@ async def test_add_node_local(controller):
|
||||
'name': 'test'},
|
||||
timeout=1200)
|
||||
assert compute in project._project_created_on_compute
|
||||
project.emit_notification.assert_any_call("node.created", node.__json__())
|
||||
project.emit_notification.assert_any_call("node.created", node.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -208,7 +208,7 @@ async def test_add_node_non_local(controller):
|
||||
'startup_script': 'test.cfg',
|
||||
'name': 'test'}, timeout=1200)
|
||||
assert compute in project._project_created_on_compute
|
||||
project.emit_notification.assert_any_call("node.created", node.__json__())
|
||||
project.emit_notification.assert_any_call("node.created", node.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -373,7 +373,7 @@ async def test_add_node_iou_no_id_available(controller):
|
||||
# })
|
||||
#
|
||||
# assert compute in project._project_created_on_compute
|
||||
# project.emit_notification.assert_any_call("node.created", node.__json__())
|
||||
# project.emit_notification.assert_any_call("node.created", node.asdict())
|
||||
#
|
||||
#
|
||||
# @pytest.mark.asyncio
|
||||
@@ -392,7 +392,7 @@ async def test_add_node_iou_no_id_available(controller):
|
||||
# }, builtin=True)
|
||||
#
|
||||
# controller.template_manager.templates[template.id] = template
|
||||
# template.__json__()
|
||||
# template.asdict()
|
||||
# controller._computes["local"] = compute
|
||||
#
|
||||
# response = MagicMock()
|
||||
@@ -407,7 +407,7 @@ async def test_add_node_iou_no_id_available(controller):
|
||||
# })
|
||||
#
|
||||
# assert compute in project._project_created_on_compute
|
||||
# project.emit_notification.assert_any_call("node.created", node.__json__())
|
||||
# project.emit_notification.assert_any_call("node.created", node.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -429,7 +429,7 @@ async def test_delete_node(controller):
|
||||
assert node.id not in project._nodes
|
||||
|
||||
compute.delete.assert_any_call('/projects/{}/vpcs/nodes/{}'.format(project.id, node.id))
|
||||
project.emit_notification.assert_any_call("node.deleted", node.__json__())
|
||||
project.emit_notification.assert_any_call("node.deleted", node.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -476,8 +476,8 @@ async def test_delete_node_delete_link(controller):
|
||||
assert link.id not in project._links
|
||||
|
||||
compute.delete.assert_any_call('/projects/{}/vpcs/nodes/{}'.format(project.id, node.id))
|
||||
project.emit_notification.assert_any_call("node.deleted", node.__json__())
|
||||
project.emit_notification.assert_any_call("link.deleted", link.__json__())
|
||||
project.emit_notification.assert_any_call("node.deleted", node.asdict())
|
||||
project.emit_notification.assert_any_call("link.deleted", link.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -541,7 +541,7 @@ async def test_add_link(project):
|
||||
await link.add_node(vm2, 4, 2)
|
||||
assert mock_udp_create.called
|
||||
assert len(link._nodes) == 2
|
||||
project.emit_notification.assert_any_call("link.created", link.__json__())
|
||||
project.emit_notification.assert_any_call("link.created", link.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -587,7 +587,7 @@ async def test_delete_link(project):
|
||||
assert len(project._links) == 1
|
||||
project.emit_notification = MagicMock()
|
||||
await project.delete_link(link.id)
|
||||
project.emit_notification.assert_any_call("link.deleted", link.__json__())
|
||||
project.emit_notification.assert_any_call("link.deleted", link.asdict())
|
||||
assert len(project._links) == 0
|
||||
|
||||
|
||||
@@ -597,7 +597,7 @@ async def test_add_drawing(project):
|
||||
project.emit_notification = MagicMock()
|
||||
drawing = await project.add_drawing(None, svg="<svg></svg>")
|
||||
assert len(project._drawings) == 1
|
||||
project.emit_notification.assert_any_call("drawing.created", drawing.__json__())
|
||||
project.emit_notification.assert_any_call("drawing.created", drawing.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -628,7 +628,7 @@ async def test_delete_drawing(project):
|
||||
assert len(project._drawings) == 1
|
||||
project.emit_notification = MagicMock()
|
||||
await project.delete_drawing(drawing.id)
|
||||
project.emit_notification.assert_any_call("drawing.deleted", drawing.__json__())
|
||||
project.emit_notification.assert_any_call("drawing.deleted", drawing.asdict())
|
||||
assert len(project._drawings) == 0
|
||||
|
||||
|
||||
@@ -703,7 +703,7 @@ async def test_open_close(controller):
|
||||
project.emit_notification = MagicMock()
|
||||
await project.close()
|
||||
assert project.status == "closed"
|
||||
project.emit_notification.assert_any_call("project.closed", project.__json__())
|
||||
project.emit_notification.assert_any_call("project.closed", project.asdict())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -62,7 +62,7 @@ def test_snapshot_filename(project):
|
||||
def test_json(project):
|
||||
|
||||
snapshot = Snapshot(project, filename="test1_260716_100439.gns3project")
|
||||
assert snapshot.__json__() == {
|
||||
assert snapshot.asdict() == {
|
||||
"snapshot_id": snapshot._id,
|
||||
"name": "test1",
|
||||
"project_id": project.id,
|
||||
|
||||
@@ -82,10 +82,10 @@ async def test_basic_topology(controller):
|
||||
|
||||
topo = project_to_topology(project)
|
||||
assert len(topo["topology"]["nodes"]) == 2
|
||||
assert node1.__json__(topology_dump=True) in topo["topology"]["nodes"]
|
||||
assert topo["topology"]["links"][0] == link.__json__(topology_dump=True)
|
||||
assert topo["topology"]["computes"][0] == compute.__json__(topology_dump=True)
|
||||
assert topo["topology"]["drawings"][0] == drawing.__json__(topology_dump=True)
|
||||
assert node1.asdict(topology_dump=True) in topo["topology"]["nodes"]
|
||||
assert topo["topology"]["links"][0] == link.asdict(topology_dump=True)
|
||||
assert topo["topology"]["computes"][0] == compute.asdict(topology_dump=True)
|
||||
assert topo["topology"]["drawings"][0] == drawing.asdict(topology_dump=True)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in new issue
Block a user