From 6ebb224aba8c2fe36ba7964bd7c2a3511c82ab9e Mon Sep 17 00:00:00 2001
From: Geert Kapteijns <ghkapteijns@gmail.com>
Date: Sun, 15 Jan 2017 17:05:19 +0100
Subject: [PATCH] Add VettingEditorFactory

---
 scipost/factories.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scipost/factories.py b/scipost/factories.py
index c69b975f6..43ada4094 100644
--- a/scipost/factories.py
+++ b/scipost/factories.py
@@ -16,6 +16,14 @@ class ContributorFactory(factory.django.DjangoModelFactory):
     vetted_by = factory.SubFactory('scipost.factories.ContributorFactory', vetted_by=None)
 
 
+class VettingEditorFactory(ContributorFactory):
+    @factory.post_generation
+    def add_to_vetting_editors(self, create, extracted, **kwargs):
+        if not create:
+            return
+        self.user.groups.add(Group.objects.get(name="Vetting Editors"))
+
+
 class UserFactory(factory.django.DjangoModelFactory):
     class Meta:
         model = get_user_model()
-- 
GitLab