Пример #1
0
 def _check_entity_data_values(self,
                               entity_id,
                               type_id="testtype",
                               type_uri=None,
                               update="Entity",
                               parent=None,
                               update_dict=None):
     "Helper function checks content of form-updated record type entry with supplied entity_id"
     recorddata = RecordTypeData.load(self.testcoll, type_id)
     self.assertTrue(EntityData.exists(recorddata, entity_id))
     e = EntityData.load(recorddata, entity_id)
     self.assertEqual(e.get_id(), entity_id)
     self.assertEqual(
         e.get_url(""),
         TestHostUri + entity_url("testcoll", type_id, entity_id))
     v = entitydata_values(entity_id,
                           type_id=type_id,
                           type_uri=type_uri,
                           update=update)
     if update_dict:
         v.update(update_dict)
         for k in update_dict:
             if update_dict[k] is None:
                 v.pop(k, None)
     self.assertDictionaryMatch(e.get_values(), v)
     return e
Пример #2
0
 def test_entitydata_create_load(self):
     e  = EntityData.create(self.testdata, "entitydata1", entitydata_create_values("entitydata1"))
     self.assertEqual(e._entitydir, entitydata_dir(entity_id="entitydata1"))
     self.assertTrue(os.path.exists(e._entitydir))
     ed = EntityData.load(self.testdata, "entitydata1").get_values()
     v  = entitydata_values("entitydata1")
     self.assertKeysMatch(ed, v)
     self.assertDictionaryMatch(ed, v)
     return
Пример #3
0
 def entities(self):
     """
     Generator enumerates and returns records of given type
     """
     for f in self._children(EntityData):
         log.debug("RecordTypeData.entities: f %s"%f)            
         e = EntityData.load(self, f)
         if e:
             yield e
     return
Пример #4
0
 def entities(self):
     """
     Generator enumerates and returns records of given type
     """
     for f in self._children(EntityData):
         log.debug("RecordTypeData.entities: f %s"%f)            
         e = EntityData.load(self, f)
         if e:
             yield e
     return
Пример #5
0
 def _check_entity_data_values(self, 
         entity_id, type_id="testtype", type_uri=None,
         update="Entity", parent=None, 
         update_dict=None):
     "Helper function checks content of form-updated record type entry with supplied entity_id"
     recorddata = RecordTypeData.load(self.testcoll, type_id)
     self.assertTrue(EntityData.exists(recorddata, entity_id))
     e = EntityData.load(recorddata, entity_id)
     self.assertEqual(e.get_id(), entity_id)
     self.assertEqual(e.get_url(""), TestHostUri + entity_url("testcoll", type_id, entity_id))
     v = entitydata_values(entity_id, type_id=type_id, type_uri=type_uri, update=update)
     if update_dict:
         v.update(update_dict)
         for k in update_dict:
             if update_dict[k] is None:
                 v.pop(k, None)
     self.assertDictionaryMatch(e.get_values(), v)
     return e