'Test that plugin position is saved after creation'

def test_plugin_order_alt(self):

    draft_page = api.create_page('PluginOrderPage', 'col_two.html', 'en', slug='page1', published=False, in_navigation=True)
    placeholder = draft_page.placeholders.get(slot='col_left')
    text_plugin_2 = api.add_plugin(placeholder, 'TextPlugin', 'en', body="I'm    the    second")
    text_plugin_3 = api.add_plugin(placeholder, 'TextPlugin', 'en', body="I'm    the    third")
    draft_page.publish('en')
    draft_page = draft_page.reload()
    placeholder = draft_page.placeholders.get(slot='col_left')
    text_plugin_1 = api.add_plugin(placeholder, 'TextPlugin', 'en', body="I'm    the    first")
    data = {'placeholder_id': placeholder.id, 'plugin_id': text_plugin_1.id, 'plugin_parent': '', 'plugin_language': 'en', 'plugin_order[]': [text_plugin_1.id, text_plugin_2.id, text_plugin_3.id]}
    endpoint = self.get_move_plugin_uri(text_plugin_1)
    self.client.post(endpoint, data)
    draft_page.publish('en')
    draft_page = draft_page.reload()
    live_page = draft_page.get_public_object()
    placeholder = draft_page.placeholders.get(slot='col_left')
    live_placeholder = live_page.placeholders.get(slot='col_left')
    with self.settings(CMS_PERMISSION=False):
        self.assertEqual(CMSPlugin.objects.get(pk=text_plugin_1.pk).position, 0)
        self.assertEqual(CMSPlugin.objects.get(pk=text_plugin_2.pk).position, 1)
        self.assertEqual(CMSPlugin.objects.get(pk=text_plugin_3.pk).position, 2)
        rendered_placeholder = placeholder.render(self.get_context(draft_page.get_absolute_url(), page=draft_page), None)
        self.assertEqual(rendered_placeholder, "I'm    the    firstI'm    the    secondI'm    the    third")
        rendered_live_placeholder = live_placeholder.render(self.get_context(live_page.get_absolute_url(), page=live_page), None)
        self.assertEqual(rendered_live_placeholder, "I'm    the    firstI'm    the    secondI'm    the    third")
    columns = api.add_plugin(placeholder, 'MultiColumnPlugin', 'en')
    column = api.add_plugin(placeholder, 'ColumnPlugin', 'en', target=columns)
    data = {'placeholder_id': placeholder.id, 'plugin_id': text_plugin_1.id, 'plugin_parent': '', 'plugin_language': 'en', 'plugin_order[]': [text_plugin_1.id, text_plugin_2.id, text_plugin_3.id, columns.id, column.id]}
    response = self.client.post(endpoint, data)
    self.assertEqual(response.status_code, 400)
    self.assertContains(response, 'order    parameter    references    plugins    in    different    trees', status_code=400)
