'Check that plugins and placeholders get correctly deleted when we delete
a page!'

def test_delete_with_plugins(self):

    Text = self.get_plugin_model('TextPlugin')
    home = create_page('home', 'nav_playground.html', 'en')
    page = create_page('page', 'nav_playground.html', 'en')
    page.rescan_placeholders()
    placeholder = page.placeholders.all()[0]
    plugin_base = CMSPlugin(plugin_type='TextPlugin', placeholder=placeholder, position=1, language=settings.LANGUAGES[0][0])
    plugin_base = plugin_base.add_root(instance=plugin_base)
    plugin = Text(body='')
    plugin_base.set_base_attr(plugin)
    plugin.save()
    self.assertEqual(CMSPlugin.objects.count(), 1)
    self.assertEqual(Text.objects.count(), 1)
    self.assertTrue((Placeholder.objects.count() > 2))
    page.delete()
    home.delete()
    self.assertEqual(CMSPlugin.objects.count(), 0)
    self.assertEqual(Text.objects.count(), 0)
    self.assertEqual(Placeholder.objects.count(), 0)
    self.assertEqual(Page.objects.count(), 0)
