Bulk change of editor group should unassign editor
See background job 7c4faab25a6d4d35bd79a793e9191928

When editor group is changed, when there is an existing editor, the job fails, as the editor is not necessarily in the new group.

Background task should unassign the editor before assigning the new group
diff --git a/doajtest/fixtures/editors.py b/doajtest/fixtures/editors.py
index 6d73c7ce8..995e1af4b 100644
--- a/doajtest/fixtures/editors.py
+++ b/doajtest/fixtures/editors.py
@@ -5,9 +5,10 @@ DEFAULT_EDITOR_GROUP_NAME = 'editorgroup'
 class EditorGroupFixtureFactory(object):
 
     @classmethod
-    def make_editor_group_source(cls, group_name=DEFAULT_EDITOR_GROUP_NAME):
+    def make_editor_group_source(cls, group_name=DEFAULT_EDITOR_GROUP_NAME, editor="eddie"):
         r = deepcopy(EDITOR_GROUP_SOURCE)
         r['name'] = group_name
+        r['editor'] = editor
         return r
 
     @classmethod
@@ -19,7 +20,7 @@ class EditorGroupFixtureFactory(object):
         models.Account(**AccountFixtureFactory.make_assed1_source()).save()
         models.Account(**AccountFixtureFactory.make_assed2_source()).save()
         models.Account(**AccountFixtureFactory.make_assed3_source()).save()
-        eg = models.EditorGroup(**cls.make_editor_group_source(group_name=group_name))
+        eg = models.EditorGroup(**cls.make_editor_group_source(group_name=group_name, editor="eddie"))
         eg.save(blocking=True)
         return eg
 
diff --git a/doajtest/unit/test_task_journal_bulkedit.py b/doajtest/unit/test_task_journal_bulkedit.py
index d9158e8ba..16846c79f 100644
--- a/doajtest/unit/test_task_journal_bulkedit.py
+++ b/doajtest/unit/test_task_journal_bulkedit.py
@@ -18,13 +18,24 @@ class TestTaskJournalBulkEdit(DoajTestCase):
     def setUp(self):
         super(TestTaskJournalBulkEdit, self).setUp()
 
+        self.default_eg = EditorGroupFixtureFactory.setup_editor_group_with_editors()
+
+        acc = models.Account()
+        acc.set_id("0987654321")
+        acc.set_email("whatever@example.com")
+        acc.save()
+
+        egs = EditorGroupFixtureFactory.make_editor_group_source("1234567890", "0987654321")
+        egm = models.EditorGroup(**egs)
+        egm.save(blocking=True)
+
         self.journals = []
         for j_src in JournalFixtureFactory.make_many_journal_sources(count=TEST_JOURNAL_COUNT):
             self.journals.append(models.Journal(**j_src))
+            self.journals[-1].set_editor_group("1234567890")
+            self.journals[-1].set_editor("0987654321")
             self.journals[-1].save()
 
-        self.default_eg = EditorGroupFixtureFactory.setup_editor_group_with_editors()
-
         self.forbidden_accounts = [
             AccountFixtureFactory.make_editor_source()['id'],
             AccountFixtureFactory.make_assed1_source()['id'],
diff --git a/doajtest/unit/test_task_suggestion_bulkedit.py b/doajtest/unit/test_task_suggestion_bulkedit.py
index 6c0f616d0..53f36ba7a 100644
--- a/doajtest/unit/test_task_suggestion_bulkedit.py
+++ b/doajtest/unit/test_task_suggestion_bulkedit.py
@@ -21,9 +21,20 @@ class TestTaskSuggestionBulkEdit(DoajTestCase):
     def setUp(self):
         super(TestTaskSuggestionBulkEdit, self).setUp()
 
+        acc = models.Account()
+        acc.set_id("0987654321")
+        acc.set_email("whatever@example.com")
+        acc.save()
+
+        egs = EditorGroupFixtureFactory.make_editor_group_source("1234567890", "0987654321")
+        egm = models.EditorGroup(**egs)
+        egm.save(blocking=True)
+
         self.suggestions = []
         for app_src in ApplicationFixtureFactory.make_many_application_sources(count=TEST_SUGGESTION_COUNT):
             self.suggestions.append(models.Suggestion(**app_src))
+            self.suggestions[-1].set_editor_group("1234567890")
+            self.suggestions[-1].set_editor("0987654321")
             self.suggestions[-1].save()
 
         self.default_eg = EditorGroupFixtureFactory.setup_editor_group_with_editors()
diff --git a/portality/tasks/journal_bulk_edit.py b/portality/tasks/journal_bulk_edit.py
index a57c37243..e3bd657cc 100644
--- a/portality/tasks/journal_bulk_edit.py
+++ b/portality/tasks/journal_bulk_edit.py
@@ -78,8 +78,15 @@ class JournalBulkEditBackgroundTask(AdminBackgroundTask):
 
             if editor_group:
                 job.add_audit_message(u"Setting editor_group to {x} for journal {y}".format(x=str(editor_group), y=journal_id))
+
+                # set the editor group
                 f = fc.form.editor_group
                 f.data = editor_group
+
+                # clear the editor
+                ed = fc.form.editor
+                ed.data = None
+
                 updated = True
                 
             if note:
diff --git a/portality/tasks/suggestion_bulk_edit.py b/portality/tasks/suggestion_bulk_edit.py
index 953817a5a..5065df887 100644
--- a/portality/tasks/suggestion_bulk_edit.py
+++ b/portality/tasks/suggestion_bulk_edit.py
@@ -82,8 +82,15 @@ class SuggestionBulkEditBackgroundTask(AdminBackgroundTask):
             if editor_group:
                 job.add_audit_message(
                     u"Setting editor_group to {x} for suggestion {y}".format(x=str(editor_group), y=suggestion_id))
+
+                # set the editor group
                 f = fc.form.editor_group
                 f.data = editor_group
+
+                # clear the editor
+                ed = fc.form.editor
+                ed.data = None
+
                 updated = True
 
             if note:
['portality/tasks/suggestion_bulk_edit.py', 'portality/tasks/journal_bulk_edit.py', 'doajtest/unit/test_task_journal_bulkedit.py', 'doajtest/fixtures/editors.py', 'doajtest/unit/test_task_suggestion_bulkedit.py']