mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-22 06:07:51 +00:00
Merge pull request #1157 from GNS3/bugfix-1156
Fixes not known category in Appliances (Fixes #1156)
This commit is contained in:
commit
fc9d44011b
@ -73,12 +73,16 @@ class Appliance:
|
||||
"""
|
||||
Appliance data (a hash)
|
||||
"""
|
||||
try:
|
||||
category = ID_TO_CATEGORY[self._data["category"]]
|
||||
except KeyError:
|
||||
category = self._data["category"]
|
||||
return {
|
||||
"appliance_id": self._id,
|
||||
"node_type": self._data["node_type"],
|
||||
"name": self._data["name"],
|
||||
"default_name_format": self._data.get("default_name_format", "{name}-{0}"),
|
||||
"category": ID_TO_CATEGORY[self._data["category"]],
|
||||
"category": category,
|
||||
"symbol": self._data.get("symbol", ":/symbols/computer.svg"),
|
||||
"compute_id": self.compute_id,
|
||||
"builtin": self._builtin
|
||||
|
@ -39,6 +39,27 @@ def test_appliance_json():
|
||||
}
|
||||
|
||||
|
||||
def test_appliance_json_with_not_known_category():
|
||||
a = Appliance(None, {
|
||||
"node_type": "qemu",
|
||||
"name": "Test",
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": 'Not known',
|
||||
"symbol": "qemu.svg",
|
||||
"server": "local"
|
||||
})
|
||||
assert a.__json__() == {
|
||||
"appliance_id": a.id,
|
||||
"node_type": "qemu",
|
||||
"builtin": False,
|
||||
"name": "Test",
|
||||
"default_name_format": "{name}-{0}",
|
||||
"category": "Not known",
|
||||
"symbol": "qemu.svg",
|
||||
"compute_id": "local"
|
||||
}
|
||||
|
||||
|
||||
def test_appliance_fix_linked_base():
|
||||
"""
|
||||
Version of the gui before 2.1 use linked_base and the server
|
||||
|
Loading…
Reference in New Issue
Block a user