mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-29 02:08:10 +00:00
Return platform value on appliances list (Fixes #2211)
This commit is contained in:
parent
fc9d44011b
commit
3fd86f5807
@ -77,6 +77,7 @@ class Appliance:
|
||||
category = ID_TO_CATEGORY[self._data["category"]]
|
||||
except KeyError:
|
||||
category = self._data["category"]
|
||||
|
||||
return {
|
||||
"appliance_id": self._id,
|
||||
"node_type": self._data["node_type"],
|
||||
@ -85,5 +86,6 @@ class Appliance:
|
||||
"category": category,
|
||||
"symbol": self._data.get("symbol", ":/symbols/computer.svg"),
|
||||
"compute_id": self.compute_id,
|
||||
"builtin": self._builtin
|
||||
"builtin": self._builtin,
|
||||
"platform": self._data.get("platform", None)
|
||||
}
|
||||
|
@ -25,7 +25,8 @@ def test_appliance_json():
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": 0,
|
||||
"symbol": "qemu.svg",
|
||||
"server": "local"
|
||||
"server": "local",
|
||||
"platform": None
|
||||
})
|
||||
assert a.__json__() == {
|
||||
"appliance_id": a.id,
|
||||
@ -35,7 +36,8 @@ def test_appliance_json():
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": "router",
|
||||
"symbol": "qemu.svg",
|
||||
"compute_id": "local"
|
||||
"compute_id": "local",
|
||||
"platform": None
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +48,8 @@ def test_appliance_json_with_not_known_category():
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": 'Not known',
|
||||
"symbol": "qemu.svg",
|
||||
"server": "local"
|
||||
"server": "local",
|
||||
"platform": None
|
||||
})
|
||||
assert a.__json__() == {
|
||||
"appliance_id": a.id,
|
||||
@ -56,7 +59,31 @@ def test_appliance_json_with_not_known_category():
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": "Not known",
|
||||
"symbol": "qemu.svg",
|
||||
"compute_id": "local"
|
||||
"compute_id": "local",
|
||||
"platform": None
|
||||
}
|
||||
|
||||
|
||||
def test_appliance_json_with_platform():
|
||||
a = Appliance(None, {
|
||||
"node_type": "dynamips",
|
||||
"name": "Test",
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": 0,
|
||||
"symbol": "dynamips.svg",
|
||||
"server": "local",
|
||||
"platform": "c3725"
|
||||
})
|
||||
assert a.__json__() == {
|
||||
"appliance_id": a.id,
|
||||
"node_type": "dynamips",
|
||||
"builtin": False,
|
||||
"name": "Test",
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": "router",
|
||||
"symbol": "dynamips.svg",
|
||||
"compute_id": "local",
|
||||
"platform": "c3725"
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user