From 7fe9c7cc94f6ba69abdf45d09a2dcc8969503514 Mon Sep 17 00:00:00 2001 From: Raphaël Barrois Date: Wed, 14 Nov 2012 23:43:03 +0100 Subject: Add MogoFactory. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Factory subclass, along the lines of DjangoModelFactory. Signed-off-by: Raphaël Barrois --- factory/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'factory') diff --git a/factory/base.py b/factory/base.py index 59f37eb..dde9f38 100644 --- a/factory/base.py +++ b/factory/base.py @@ -660,6 +660,14 @@ class DjangoModelFactory(Factory): return target_class._default_manager.create(*args, **kwargs) +class MogoFactory(Factory): + """Factory for mogo objects.""" + ABSTRACT_FACTORY = True + + def _build(cls, target_class, *args, **kwargs): + return target_class.new(*args, **kwargs) + + def make_factory(klass, **kwargs): """Create a new, simple factory for the given class.""" factory_name = '%sFactory' % klass.__name__ -- cgit v1.2.3