'Test that CMSPlugin copy does not have side effects'

def test_copy_plugins_method(self):

    page_en = api.create_page('CopyPluginTestPage    (EN)', 'nav_playground.html', 'en')
    page_de = api.create_page('CopyPluginTestPage    (DE)', 'nav_playground.html', 'de')
    ph_en = page_en.placeholders.get(slot='body')
    ph_de = page_de.placeholders.get(slot='body')
    text_plugin_en = api.add_plugin(ph_en, 'TextPlugin', 'en', body='Hello    World')
    self.assertEqual(text_plugin_en.pk, CMSPlugin.objects.all()[0].pk)
    link_plugin_en = api.add_plugin(ph_en, 'LinkPlugin', 'en', target=text_plugin_en, name='A    Link', external_link='https://www.django-cms.org')
    text_plugin_en.body += plugin_to_tag(link_plugin_en)
    text_plugin_en.save()
    text_plugin_en = self.reload(text_plugin_en)
    plugins = [text_plugin_en, link_plugin_en]
    old_ids = [plugin.pk for plugin in plugins]
    new_plugins = []
    plugins_ziplist = []
    old_parent_cache = {}
    for plugin in plugins:
        new_plugins.append(plugin.copy_plugin(ph_de, 'de', old_parent_cache))
        plugins_ziplist.append((new_plugins[(-1)], plugin))
    for (idx, plugin) in enumerate(plugins):
        (inst, _) = new_plugins[idx].get_plugin_instance()
        new_plugins[idx] = inst
        new_plugins[idx].post_copy(plugin, plugins_ziplist)
    for (idx, plugin) in enumerate(plugins):
        self.assertEqual(old_ids[idx], plugin.pk)
        self.assertNotEqual(new_plugins[idx], plugin.pk)
        if (plugin.plugin_type == 'TextPlugin'):
            self.assertTrue(('Link    -    A    Link' in plugin.body))
            self.assertTrue((('id="%s"' % plugin.get_children()[0].pk) in plugin.body))
            self.assertTrue(('Link    -    A    Link' in new_plugins[idx].body))
            self.assertTrue((('id="%s"' % new_plugins[idx].get_children()[0].pk) in new_plugins[idx].body))
