def test_empty_name(): app = make_app(_setup, 'test_output') c = Client(app) appiter, code, headers = c.open('/_shared/test_shared.py') assert 'add_shared' in ''.join(appiter) assert dict(headers)['Content-Type'] == 'text/x-python'
def test_shared_dir(): app = make_app(_setup, 'test_output') c = Client(app) appiter, code, headers = c.open('/_shared/test/') assert '404 NOT FOUND' == code
def test_url(): app = make_app(_setup, 'test_output') c = Client(app) appiter, code, headers = c.open('/') assert ''.join(appiter) == '/_shared/test/blah'
import os from glashammer import run_very_simple, make_app, Response from glashammer.bundles.auth import setup_auth, auth_protected_view def setup(app): app.add_setup(setup_auth) app.connect_event('password-check', dumb_password_checker) app.add_url('/', 'home', view=homepage_view) def dumb_password_checker(username, password): return True @auth_protected_view def homepage_view(req): return Response( '<h1>Hello, authorized world!</h1>' '<a href="/logout">Log Out</a>' ) if __name__ == '__main__': app = make_app(setup, os.path.dirname(__file__)) run_very_simple(app)
def setUp(self): self.app = make_app(_setup) self.c = Client(self.app)
def test_template_kw(): app = make_app(_setup) assert not app.template_env.trim_blocks app = make_app(_setup, template_env_kw={"trim_blocks": True}) assert app.template_env.trim_blocks