Introduce factory_boy
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 2 Feb 2013 12:16:38 +0000 (13:16 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 2 Feb 2013 12:17:23 +0000 (13:17 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
dev_requirements.txt
xnet/group/factories.py [new file with mode: 0644]

index e69de29..d3b12b2 100644 (file)
@@ -0,0 +1 @@
+factory_boy>=1.2.0
diff --git a/xnet/group/factories.py b/xnet/group/factories.py
new file mode 100644 (file)
index 0000000..6ce1657
--- /dev/null
@@ -0,0 +1,13 @@
+import factory
+
+from . import models
+
+
+class GroupFactory(factory.DjangoModelFactory):
+    FACTORY_FOR = models.Group
+
+    name = factory.Sequence(lambda n: u"Groupe n°%s" % n)
+    short = factory.Sequence(lambda n: u"Groupe%s" % n)
+    kind = models.Group.KIND_GROUP
+    domain = models.Group.DOMAIN_REGION
+