Example #1
0
 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
Example #2
0
 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
Example #3
0
 def testGetResourcesWithSomeResources(self):
     devices = self.SomeDevices()
     sut = DeviceResourceRepository(DeviceType(), devices)
     self.assertNotEquals(len(sut.get_resources()), 0)
Example #4
0
 def testGetResourceWithUnknownResources(self):
     devices = self.SomeDevices()
     sut = DeviceResourceRepository(DeviceType(), devices)
     with self.assertRaises(ResourceNotFound):
         sut.get_resource('baz')
Example #5
0
 def testGetResourceWithoutResources(self):
     devices = self.NoDevices()
     sut = DeviceResourceRepository(DeviceType(), devices)
     with self.assertRaises(ResourceNotFound):
         sut.get_resource('foo')
Example #6
0
 def testGetResource(self):
     devices = self.SomeDevices()
     sut = DeviceResourceRepository(DeviceType(), devices)
     sut.get_resource('foo')
Example #7
0
 def testGetType(self):
     devices = self.NoDevices()
     sut = DeviceResourceRepository(DeviceType(), devices)
     self.assertIsInstance(sut.get_type(), OutputDataType)
Example #8
0
 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
Example #9
0
 def __init__(self):
     DeviceType.__init__(self, 'ola')
     PowerableType.__init__(self)
     Rgb24ColorableType.__init__(self)
     IlluminativeType.__init__(self)
     InputDataType.__init__(self)