import mock

from django.test import TestCase
from django.template import RequestContext

from fancypages.models import Container
from fancypages.models.blocks import TwoColumnLayoutBlock

from fancypages.test import factories


class TestTwoColumnLayoutBlock(TestCase):

    def setUp(self):
        super(TestTwoColumnLayoutBlock, self).setUp()
        self.user = factories.UserFactory.build()

        self.request_context = RequestContext(mock.MagicMock())
        self.request_context['user'] = self.user

    def test_generates_two_empty_containers_when_rendered(self):
        container = Container.objects.create(name='test-container')
        block = TwoColumnLayoutBlock.objects.create(container=container)

        self.assertEquals(block.containers.count(), 0)
        renderer = block.get_renderer_class()(block, self.request_context)
        block_html = renderer.render()

        self.assertEquals(block.containers.count(), 2)

@@ -389,16 +389,82 @@
 .build()
+%0A        self.request = mock.Mock()%0A        self.request.META = %7B%7D
 %0A%0A      
@@ -507,24 +507,24 @@
 ext(
-mock.MagicMock()
+self.request, %7B%7D
 )%0A  
@@ -919,21 +919,8 @@
     
- block_html =
  ren

Fix mock of request for block rendering