summaryrefslogtreecommitdiff
path: root/factory/base.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2012-11-14 23:43:03 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2012-11-15 00:03:37 +0100
commit7fe9c7cc94f6ba69abdf45d09a2dcc8969503514 (patch)
treeeedc94a7a202e56d7075e1a9e008902a3049c815 /factory/base.py
parent5ec4a50edc67073e54218549d6985f934f94b88f (diff)
downloadfactory-boy-7fe9c7cc94f6ba69abdf45d09a2dcc8969503514.tar
factory-boy-7fe9c7cc94f6ba69abdf45d09a2dcc8969503514.tar.gz
Add MogoFactory.
A Factory subclass, along the lines of DjangoModelFactory. Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'factory/base.py')
-rw-r--r--factory/base.py8
1 files changed, 8 insertions, 0 deletions
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__