def test_serialize(self):
        # Valid room
        data = SensorSerializer.serialize(SensorDTO(id=1, name='foo', room=5),
                                          fields=['id', 'name', 'room'])
        self.assertEqual({'id': 1,
                          'name': 'foo',
                          'room': 5}, data)
        # Empty room
        data = SensorSerializer.serialize(SensorDTO(id=1, name='foo'),
                                          fields=['id', 'name', 'room'])
        self.assertEqual({'id': 1,
                          'name': 'foo',
                          'room': 255}, data)
        # No room
        data = SensorSerializer.serialize(SensorDTO(id=1, name='foo', room=5),
                                          fields=['id', 'name'])
        self.assertEqual({'id': 1,
                          'name': 'foo'}, data)