'Test the "fix up behavior" when groups are missing (after a group is added to a group configuration).
This test actually belongs over in common, but it relies on a mutable modulestore.
TODO: move tests that can go over to common after the mixed modulestore work is done.  # pylint: disable=fixme'

def test_add_groups(self):

    split_test = self._update_partition_id(self.first_user_partition.id)
    new_group_id = '1002'
    split_test.user_partitions = [UserPartition(self.first_user_partition.id, 'first_partition', 'First    Partition', [self.first_user_partition_group_1, self.first_user_partition_group_2, Group(new_group_id, 'pie')])]
    self.store.update_item(split_test, self.user.id)
    split_test = self._assert_children(2)
    group_id_to_child = split_test.group_id_to_child.copy()
    self.assertEqual(2, len(group_id_to_child))
    split_test.runtime._services['user'] = DjangoXBlockUserService(self.user)
    split_test.add_missing_groups(self.request)
    split_test = self._assert_children(3)
    self.assertNotEqual(group_id_to_child, split_test.group_id_to_child)
    group_id_to_child = split_test.group_id_to_child
    self.assertEqual(split_test.children[2], group_id_to_child[new_group_id])
    split_test.add_missing_groups(self.request)
    split_test = self._assert_children(3)
    self.assertEqual(group_id_to_child, split_test.group_id_to_child)
