def setUp(self):
     # create context mock
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     SessionMiddleware().process_request(request)
     request.session.save()
     self.context = RequestContext(request)
     self.plugin = GalleryPluginFactory()
     self.cmsplugin = CMSGalleryPlugin()
 def setUp(self):
     # create context mock
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     SessionMiddleware().process_request(request)
     request.session.save()
     self.context = RequestContext(request)
     self.plugin = GalleryPluginFactory()
     self.cmsplugin = CMSGalleryPlugin()
class CMSGalleryPluginTestCase(TestCase):
    """Tests for the ``CMSGalleryPlugin`` cmsplugin."""
    longMessage = True

    def setUp(self):
        # create context mock
        request = RequestFactory().get('/')
        request.user = AnonymousUser()
        SessionMiddleware().process_request(request)
        request.session.save()
        self.context = RequestContext(request)
        self.plugin = GalleryPluginFactory()
        self.cmsplugin = CMSGalleryPlugin()

    def test_render(self):
        self.assertEqual(
            self.cmsplugin.render(context=self.context, instance=self.plugin,
                                  placeholder=None).get('gallery'),
            self.plugin.gallery)
class CMSGalleryPluginTestCase(TestCase):
    """Tests for the ``CMSGalleryPlugin`` cmsplugin."""
    longMessage = True

    def setUp(self):
        # create context mock
        request = RequestFactory().get('/')
        request.user = AnonymousUser()
        SessionMiddleware().process_request(request)
        request.session.save()
        self.context = RequestContext(request)
        self.plugin = GalleryPluginFactory()
        self.cmsplugin = CMSGalleryPlugin()

    def test_render(self):
        self.assertEqual(
            self.cmsplugin.render(context=self.context,
                                  instance=self.plugin,
                                  placeholder=None).get('gallery'),
            self.plugin.gallery)