Ejemplo n.º 1
0
    def testMainComponentCreation(self):
        from bricks.app_bricks import BaseMC, mc_from_routemap

        root = Route()
        r1 = Route()
        r2 = Route()
        r3 = Route()

        routemap = root + {'first': r1 + {'second': r2, 'third': r3}}

        routelist = [root, r1, r2, r3]

        def mock_init(inst, *routes):
            self.assertEqual(set(routes), set(routelist))

        BaseMC.__init__ = mock_init
        main_component = mc_from_routemap(routemap)
        self.assertEqual(set(main_component.depends_on), set(routelist))
        create_app(main_component)
Ejemplo n.º 2
0
    def testMainComponentCreation(self):
        from bricks.app_bricks import BaseMC, mc_from_routemap

        root = Route()
        r1 = Route()
        r2 = Route()
        r3 = Route()

        routemap = root + {
            'first': r1 + {
                'second': r2,
                'third': r3
            }
        }

        routelist = [root, r1, r2, r3]

        def mock_init(inst, *routes):
            self.assertEqual(set(routes), set(routelist))

        BaseMC.__init__ = mock_init
        main_component = mc_from_routemap(routemap)
        self.assertEqual(set(main_component.depends_on), set(routelist))
        create_app(main_component)
Ejemplo n.º 3
0
 def testAppCreation(self):
     app = create_app(MockMain)
     request = Request.blank('/some/url/doesnt/matter')
     response = request.get_response(app)
     self.assertEqual(response.body, b"hello world")
Ejemplo n.º 4
0
 def testAppCreation(self):
     app = create_app(MockMain)
     request = Request.blank('/some/url/doesnt/matter')
     response = request.get_response(app)
     self.assertEqual(response.body, b"hello world")