From ee5317948bb258d610ab1c8b5405a4b1ca69f4fb Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 6 Apr 2018 14:32:06 +0700 Subject: [PATCH] Fix tests. --- gns3server/controller/ports/port.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gns3server/controller/ports/port.py b/gns3server/controller/ports/port.py index fb9acae8..df670ec5 100644 --- a/gns3server/controller/ports/port.py +++ b/gns3server/controller/ports/port.py @@ -93,13 +93,16 @@ class Port: self._short_name = val def __json__(self): - return { + info = { "name": self._name, "short_name": self.short_name, "data_link_types": self.data_link_types, "port_number": self._port_number, "adapter_number": self._adapter_number, - "adapter_type": self._adapter_type, - "mac_address": self._mac_address, "link_type": self.link_type } + if self._adapter_type: + info["adapter_type"] = self._adapter_type + if self._mac_address: + info["mac_address"] = self._mac_address + return info