def test_binds_to_its_bin(self): app = core.Application() self.assertSubdict( [ ("app", app), ("config", app.config), ("manager", app.manager), ("router", app.router), ], app.bin.globals, )
def test_it_delegates_routes_to_the_router(self): class Router(object): def add(this, route, fn, baz): self.added = route, fn, baz application = core.Application(router=Router()) @application.route("/foo", baz=2) def fn(request): pass self.assertEqual(getattr(self, "added", None), ("/foo", fn, 2))
def test_it_can_bind_to_jinja_environments(self): environment = jinja2.Environment() app = core.Application(jinja=environment) self.assertEqual(app.bin.globals["jinja"], environment) self.assertSubdict( [ ("app", app), ("config", app.config), ("router", app.router), ], environment.globals, )
def test_it_can_bind_to_other_bins(self): app = core.Application() bin = assets.Bin(manager=app.manager) app.bind_bin(bin) self.assertSubdict( [ ("app", app), ("config", app.config), ("manager", app.manager), ("router", app.router), ], bin.globals, )
def test_binds_to_its_bin(self): app = core.Application() self.assertEqual( ( app.bin.provide("app"), app.bin.provide("config"), app.bin.provide("manager"), app.bin.provide("router"), ), ( app, app.config, app.manager, app.router, ), )
def test_it_can_bind_to_other_bins(self): app = core.Application() bin = app.bound_bin(assets.Bin()) self.assertEqual( ( bin.provide("app"), bin.provide("config"), bin.provide("manager"), bin.provide("router"), ), ( app, app.config, app.manager, app.router, ), )
def setUp(self): self.manager = Manager() self.router = Router(mapper=SimpleMapper()) self.app = core.Application(manager=self.manager, router=self.router) self.request = Request(url=URL(path=[u""]))
def test_it_can_bind_to_jinja_environments(self): environment = jinja2.Environment() app = core.Application(jinja=environment) self.assertEqual(app.bin.provide("jinja"), environment)