Beispiel #1
0
 def test_page_only_plugins(self):
     ex = Example1(char_1='one', char_2='two', char_3='tree', char_4='four')
     ex.save()
     response = self.client.get(
         reverse('admin:placeholderapp_example1_change', args=(ex.pk, )))
     self.assertEqual(response.status_code, 200)
     self.assertNotContains(response, 'InheritPagePlaceholderPlugin')
Beispiel #2
0
 def test_excercise_get_attached_models_notplugins(self):
     ex = Example1(char_1='one', char_2='two', char_3='tree', char_4='four')
     ex.save()
     ph = ex.placeholder
     result = list(ph._get_attached_models())
     self.assertEqual(result, [Example1])  # Simple PH - Example1 model
     add_plugin(ph, TextPlugin, 'en', body='en body')
     result = list(ph._get_attached_models())
     self.assertEqual(result,
                      [Example1])  # Simple PH still one Example1 model
Beispiel #3
0
 def test_excercise_get_attached_fields_notplugins(self):
     ex = Example1(
         char_1='one',
         char_2='two',
         char_3='tree',
         char_4='four',
     )
     ex.save()
     ph = ex.placeholder
     result = [f.name for f in list(ph._get_attached_fields())]
     self.assertEqual(result,
                      ['placeholder'])  # Simple PH - placeholder field name
     add_plugin(ph, TextPlugin, 'en', body='en body')
     result = [f.name for f in list(ph._get_attached_fields())]
     self.assertEqual(
         result,
         ['placeholder'])  # Simple PH - still one placeholder field name
Beispiel #4
0
 def _create_example(self):
     ex = Example1(char_1='one', char_2='two', char_3='tree', char_4='four')
     ex.save()
     self._placeholder = ex.placeholder