def test_inter_placeholder_plugin_move(self):
        ex = TwoPlaceholderExample(
            char_1='one',
            char_2='two',
            char_3='tree',
            char_4='four'
        )
        ex.save()
        ph1 = ex.placeholder_1
        ph2 = ex.placeholder_2
        ph1_pl1 = add_plugin(ph1, 'TextPlugin', 'en', body='ph1 plugin1').cmsplugin_ptr
        ph1_pl2 = add_plugin(ph1, 'TextPlugin', 'en', body='ph1 plugin2').cmsplugin_ptr
        ph1_pl3 = add_plugin(ph1, 'TextPlugin', 'en', body='ph1 plugin3').cmsplugin_ptr
        ph2_pl1 = add_plugin(ph2, 'TextPlugin', 'en', body='ph2 plugin1').cmsplugin_ptr
        ph2_pl2 = add_plugin(ph2, 'TextPlugin', 'en', body='ph2 plugin2').cmsplugin_ptr
        ph2_pl3 = add_plugin(ph2, 'TextPlugin', 'en', body='ph2 plugin3').cmsplugin_ptr

        data = {
            'placeholder_id': str(ph2.pk),
            'plugin_id': str(ph1_pl2.pk),
            'target_language': 'en',
            'plugin_order[]': [str(p.pk) for p in [ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2]]
        }
        endpoint = self.get_move_plugin_uri(ph1_pl2, container=TwoPlaceholderExample)

        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 200)
        self.assertEqual([ph1_pl1, ph1_pl3], list(ph1.cmsplugin_set.order_by('position')))
        self.assertEqual([ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2, ], list(ph2.cmsplugin_set.order_by('position')))
Beispiel #2
0
    def test_inter_placeholder_plugin_move(self):
        ex = TwoPlaceholderExample(
            char_1='one',
            char_2='two',
            char_3='tree',
            char_4='four'
        )
        ex.save()
        ph1 = ex.placeholder_1
        ph2 = ex.placeholder_2
        ph1_pl1 = add_plugin(ph1, TextPlugin, 'en', body='ph1 plugin1').cmsplugin_ptr
        ph1_pl2 = add_plugin(ph1, TextPlugin, 'en', body='ph1 plugin2').cmsplugin_ptr
        ph1_pl3 = add_plugin(ph1, TextPlugin, 'en', body='ph1 plugin3').cmsplugin_ptr
        ph2_pl1 = add_plugin(ph2, TextPlugin, 'en', body='ph2 plugin1').cmsplugin_ptr
        ph2_pl2 = add_plugin(ph2, TextPlugin, 'en', body='ph2 plugin2').cmsplugin_ptr
        ph2_pl3 = add_plugin(ph2, TextPlugin, 'en', body='ph2 plugin3').cmsplugin_ptr

        data = {
            'placeholder_id': str(ph2.pk),
            'plugin_id': str(ph1_pl2.pk),
            'plugin_order[]': [str(p.pk) for p in [ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2]]
        }
        endpoint = self.get_move_plugin_uri(ph1_pl2, container=TwoPlaceholderExample)

        response = self.client.post(endpoint, data)
        self.assertEqual(response.status_code, 200)
        self.assertEqual([ph1_pl1, ph1_pl3], list(ph1.cmsplugin_set.order_by('position')))
        self.assertEqual([ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2, ], list(ph2.cmsplugin_set.order_by('position')))
Beispiel #3
0
    def test_placeholder_tabs(self):
        ex = TwoPlaceholderExample(char_1="one", char_2="two", char_3="one", char_4="two")
        ex.save()
        self._testuser()
        self.client.login(username="******", password="******")

        response = self.client.get("/de/admin/placeholderapp/twoplaceholderexample/%d/" % ex.pk)
        self.assertNotContains(
            response,
            """<input type="button" onclick="trigger_lang_button(this,'./?language=en');" class="language_button selected" id="debutton" name="en" value="English">""",
        )
Beispiel #4
0
    def test_placeholder_tabs(self):
        ex = TwoPlaceholderExample(
            char_1='one',
            char_2='two',
            char_3='one',
            char_4='two',
        )
        ex.save()
        self._testuser()
        self.client.login(username='******', password='******')

        response = self.client.get('/de/admin/placeholderapp/twoplaceholderexample/%d/' % ex.pk)
        self.assertNotContains(response,
                               """<input type="button" onclick="trigger_lang_button(this,'./?language=en');" class="language_button selected" id="debutton" name="en" value="English">""")
 def test_inter_placeholder_plugin_move(self):
     ex = TwoPlaceholderExample(char_1='one',
                                char_2='two',
                                char_3='tree',
                                char_4='four')
     ex.save()
     ph1 = ex.placeholder_1
     ph2 = ex.placeholder_2
     ph1_pl1 = add_plugin(ph1, TextPlugin, 'en',
                          body='ph1 plugin1').cmsplugin_ptr
     ph1_pl2 = add_plugin(ph1, TextPlugin, 'en',
                          body='ph1 plugin2').cmsplugin_ptr
     ph1_pl3 = add_plugin(ph1, TextPlugin, 'en',
                          body='ph1 plugin3').cmsplugin_ptr
     ph2_pl1 = add_plugin(ph2, TextPlugin, 'en',
                          body='ph2 plugin1').cmsplugin_ptr
     ph2_pl2 = add_plugin(ph2, TextPlugin, 'en',
                          body='ph2 plugin2').cmsplugin_ptr
     ph2_pl3 = add_plugin(ph2, TextPlugin, 'en',
                          body='ph2 plugin3').cmsplugin_ptr
     response = self.client.post(
         reverse('admin:placeholderapp_twoplaceholderexample_move_plugin'),
         {
             'placeholder_id':
             str(ph2.pk),
             'plugin_id':
             str(ph1_pl2.pk),
             'plugin_order[]':
             [str(p.pk) for p in [ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2]]
         })
     self.assertEqual(response.status_code, 200)
     self.assertEqual([ph1_pl1, ph1_pl3],
                      list(ph1.cmsplugin_set.order_by('position')))
     self.assertEqual([
         ph2_pl3,
         ph2_pl1,
         ph2_pl2,
         ph1_pl2,
     ], list(ph2.cmsplugin_set.order_by('position')))
Beispiel #6
0
 def test_inter_placeholder_plugin_move(self):
     ex = TwoPlaceholderExample(char_1="one", char_2="two", char_3="tree", char_4="four")
     ex.save()
     ph1 = ex.placeholder_1
     ph2 = ex.placeholder_2
     ph1_pl1 = add_plugin(ph1, TextPlugin, "en", body="ph1 plugin1").cmsplugin_ptr
     ph1_pl2 = add_plugin(ph1, TextPlugin, "en", body="ph1 plugin2").cmsplugin_ptr
     ph1_pl3 = add_plugin(ph1, TextPlugin, "en", body="ph1 plugin3").cmsplugin_ptr
     ph2_pl1 = add_plugin(ph2, TextPlugin, "en", body="ph2 plugin1").cmsplugin_ptr
     ph2_pl2 = add_plugin(ph2, TextPlugin, "en", body="ph2 plugin2").cmsplugin_ptr
     ph2_pl3 = add_plugin(ph2, TextPlugin, "en", body="ph2 plugin3").cmsplugin_ptr
     response = self.client.post(
         reverse("admin:placeholderapp_twoplaceholderexample_move_plugin"),
         {
             "placeholder_id": str(ph2.pk),
             "plugin_id": str(ph1_pl2.pk),
             "plugin_order[]": [str(p.pk) for p in [ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2]],
         },
     )
     self.assertEqual(response.status_code, 200)
     self.assertEqual([ph1_pl1, ph1_pl3], list(ph1.cmsplugin_set.order_by("position")))
     self.assertEqual([ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2], list(ph2.cmsplugin_set.order_by("position")))
Beispiel #7
0
 def test_inter_placeholder_plugin_move(self):
     ex = TwoPlaceholderExample(
         char_1='one',
         char_2='two',
         char_3='tree',
         char_4='four'
     )
     ex.save()
     ph1 = ex.placeholder_1
     ph2 = ex.placeholder_2
     ph1_pl1 = add_plugin(ph1, TextPlugin, 'en', body='ph1 plugin1').cmsplugin_ptr
     ph1_pl2 = add_plugin(ph1, TextPlugin, 'en', body='ph1 plugin2').cmsplugin_ptr
     ph1_pl3 = add_plugin(ph1, TextPlugin, 'en', body='ph1 plugin3').cmsplugin_ptr
     ph2_pl1 = add_plugin(ph2, TextPlugin, 'en', body='ph2 plugin1').cmsplugin_ptr
     ph2_pl2 = add_plugin(ph2, TextPlugin, 'en', body='ph2 plugin2').cmsplugin_ptr
     ph2_pl3 = add_plugin(ph2, TextPlugin, 'en', body='ph2 plugin3').cmsplugin_ptr
     response = self.client.post(reverse('admin:placeholderapp_twoplaceholderexample_move_plugin'), {
         'placeholder_id': str(ph2.pk),
         'plugin_id': str(ph1_pl2.pk),
         'plugin_order[]': [str(p.pk) for p in [ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2]]
     })
     self.assertEqual(response.status_code, 200)
     self.assertEqual([ph1_pl1, ph1_pl3], list(ph1.cmsplugin_set.order_by('position')))
     self.assertEqual([ph2_pl3, ph2_pl1, ph2_pl2, ph1_pl2, ], list(ph2.cmsplugin_set.order_by('position')))