Exemplo n.º 1
0
 def obj2Fiware(clsself,
                _object,
                ind=0,
                dataTypeDict={},
                ignorePythonMetaData=False,
                showIdValue=True):
     en = Entity()
     en.setObject(_object,
                  dataTypeDict,
                  ignorePythonMetaData,
                  showIdValue=showIdValue)
     return clsself._json(en, ind)
Exemplo n.º 2
0
 def test_EntityAttributeCompletely(self):
     # General functionality given.
     entity = Entity()
     entity.setObject(ComplexExample(), {}, False)
     ComplexExample().ToJSON(entity)
Exemplo n.º 3
0
 def test_Entitiy_setObejct_Non_Primitve_WITH_OUT_type_id(self):
     en = Entity()
     en.setObject(TestClass(), {}, False, showIdValue=False)
     self.assertFalse(hasattr(en, "id"))
     self.assertFalse(hasattr(en, "type"))
     self.assertEqual(en.__dict__['value'].value, 1)
Exemplo n.º 4
0
 def test_Entitiy_setObejct_Non_Primitve_WITH_given_type_id(self):
     en = Entity()
     en.setObject(TypeIDTestClass(), {}, False)
     self.assertEqual(en.id[0:9], "MyId")
     self.assertEqual(en.type, "This should NOT be overwritten")
     self.assertEqual(en.__dict__['value'].value, 1)
Exemplo n.º 5
0
 def test_Entitiy_setObejct_Non_Primitve(self):
     en = Entity()
     en.setObject(TestClass(), {}, False)
     self.assertEqual(en.id[0:9], "TestClass")
     self.assertEqual(en.type, "TestClass")
     self.assertEqual(en.__dict__['value'].value, 1)
Exemplo n.º 6
0
 def test_Entitiy_setObejct_Primitve(self):
     en = Entity()
     try:
         en.setObject(1, {}, False)
     except ValueError:
         self.assertTrue(True)
Exemplo n.º 7
0
 def test_EntityInitializeIsNotEmpty(self):
     en = Entity()
     self.assertEqual(en.type, "Entity")
     self.assertEqual(en.id[0:6], "Entity")