예제 #1
0
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'
예제 #2
0
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
예제 #3
0
def test_url():
    app = make_app(_setup, 'test_output')
    c = Client(app)
    appiter, code, headers = c.open('/')
    assert ''.join(appiter) == '/_shared/test/blah'
예제 #4
0
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)



예제 #5
0
 def setUp(self):
     self.app = make_app(_setup)
     self.c = Client(self.app)
예제 #6
0
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