fix another generate_test_data bug

This commit is contained in:
Jack Robison 2018-10-11 18:04:10 -04:00
parent 265c03a5da
commit 9b40301a23
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -199,9 +199,12 @@ class UPnP:
except (UPnPError, NotImplementedError):
print("failed to add and remove a mapping")
device = list(self.gateway.devices.values())[0]
assert device.manufacturer and device.modelName
device_path = os.path.join(os.getcwd(), self.gateway.manufacturer_string)
if self.gateway._device:
device = list(self.gateway.devices.values())[0]
assert device.manufacturer and device.modelName
device_path = os.path.join(os.getcwd(), self.gateway.manufacturer_string)
else:
device_path = os.path.join(os.getcwd(), "UNKNOWN GATEWAY")
with open(device_path, "w") as f:
f.write(json.dumps({
"gateway": self.gateway.debug_gateway(),