def _build_instance(self, model, kwargs, objs, create):
     if kwargs is not None:
         obj = create_instance(model, **kwargs)
     else:
         obj = create_instance(model)
     if create:
         obj.save()
     objs.append(obj)
 def _build_instance(self, model, kwargs, objs, create):
     if kwargs is not None:
         obj = create_instance(model, **kwargs)
     else:
         obj = create_instance(model)
     if create:
         obj.save()
     objs.append(obj)
    def setUp(self):
        self.model_one = create_instance(ModelOne)

        if PY3:
            self.basestring = (str, bytes)
        else:
            self.basestring = basestring
示例#4
0
    def setUp(self):
        self.model_one = create_instance(ModelOne)

        if PY3:
            self.basestring = (str, bytes)
        else:
            self.basestring = basestring
 def setUp(self):
     self.model_one = create_instance(ModelOne)
     self.model_two_rand = create_instance(ModelTwo)
     self.model_two_kwarg = create_instance(ModelTwo,
                                            foreign_key=self.model_one)
示例#6
0
 def setUp(self):
     self.model_one = create_instance(ModelOne)
     self.model_two_rand = create_instance(ModelTwo)
     self.model_two_kwarg = create_instance(
         ModelTwo, foreign_key=self.model_one)
示例#7
0
 def _handle_build(self, *args):
     model, kwargs_iter = self._resolve_args(*args)
     return (create_instance(model, **(kwargs if kwargs else {}))
             for kwargs in kwargs_iter)