Example #1
0
 def instantiate_model(self, model_name, model_id, name="Default"):
     return ModelRegistry.get_model(model_name)._set_data({
         "id":
         model_id,
         "name":
         name
     })
Example #2
0
    def __init__(self, model_name, aqhttp, session):
        """Instantiates a new model interface. Uses aqhttp to make requests,
        and deserializes response to models.

        :param model_name: Model name (e.g. 'Sample' or 'FieldValue')
        :type model_name: basestring
        :param aqhttp: the AqHTTP instance
        :type aqhttp: AqHTTP
        :param session:
        :type session:
        """
        super().__init__(aqhttp, session)
        self.crud = CRUDInterface(aqhttp, session)
        self.model = ModelRegistry.get_model(model_name)
        self._do_load = True
Example #3
0
 def __init__(self, model_name, aqhttp, session):
     super().__init__(aqhttp, session)
     self.crud = CRUDInterface(aqhttp, session)
     self.model = ModelRegistry.get_model(model_name)
     self._do_load = True
     self._preload_field_values = None
Example #4
0
 def get_model(self):
     return ModelRegistry.get_model(self.nested)
Example #5
0
 def test_nested_dump_benchmark(self, base, Author, Publisher, Company,
                                benchmark, model, include, expected):
     instance = ModelRegistry.get_model(model)()
     benchmark(instance.dump, include=include)
     assert instance.dump(include=include) == expected