def to_json(self, data): json_data = {} json_data.update(DeviceType.to_json(self, data)) json_data.update(PowerableType.to_json(self, data)) json_data.update(Rgb24ColorableType.to_json(self, data)) json_data.update(IlluminativeType.to_json(self, data)) return json_data
def update_from_json(self, json_data, instance): assert isinstance(instance, Ola) instance = DeviceType.update_from_json(self, json_data, instance) instance = PowerableType.update_from_json(self, json_data, instance) instance = Rgb24ColorableType.update_from_json( self, json_data, instance) instance = IlluminativeType.update_from_json(self, json_data, instance) return instance
def testGetResourcesWithSomeResources(self): devices = self.SomeDevices() sut = DeviceResourceRepository(DeviceType(), devices) self.assertNotEquals(len(sut.get_resources()), 0)
def testGetResourceWithUnknownResources(self): devices = self.SomeDevices() sut = DeviceResourceRepository(DeviceType(), devices) with self.assertRaises(ResourceNotFound): sut.get_resource('baz')
def testGetResourceWithoutResources(self): devices = self.NoDevices() sut = DeviceResourceRepository(DeviceType(), devices) with self.assertRaises(ResourceNotFound): sut.get_resource('foo')
def testGetResource(self): devices = self.SomeDevices() sut = DeviceResourceRepository(DeviceType(), devices) sut.get_resource('foo')
def testGetType(self): devices = self.NoDevices() sut = DeviceResourceRepository(DeviceType(), devices) self.assertIsInstance(sut.get_type(), OutputDataType)
def get_json_schema(self): schema = DeviceType.get_json_schema(self) schema.update(PowerableType.get_json_schema(self)) schema.update(Rgb24ColorableType.get_json_schema(self)) schema.update(IlluminativeType.get_json_schema(self)) return schema
def __init__(self): DeviceType.__init__(self, 'ola') PowerableType.__init__(self) Rgb24ColorableType.__init__(self) IlluminativeType.__init__(self) InputDataType.__init__(self)