def __init__(self, apiClient, **kwargs): self._apiClient = apiClient if not set(["clientId", "deviceId", "typeId"]).issubset(kwargs): raise Exception("Data passed to Device is not correct: %s" % (json.dumps(kwargs, sort_keys=True))) self.diagLogs = DeviceLogs(self._apiClient, kwargs["typeId"], kwargs["deviceId"]) self.diagErrorCodes = DeviceErrorCodes(self._apiClient, kwargs["typeId"], kwargs["deviceId"]) dict.__init__(self, **kwargs)
def testDeviceLogsMissing(self): with pytest.raises(Exception) as e: DeviceLogs(apiClient="1", typeId="2", deviceId="3").__missing__(key="1") assert "Log Entry does not exist" in str(e.value)
def testDeviceLogsSetItem(self): with pytest.raises(Exception) as e: DeviceLogs(apiClient="1", typeId="2", deviceId="3").__setitem__(key="1", value="2") assert "Log entries are immutable" in str(e.value)