def test_values_as_template_context(): c = Clay(TESTS) t = c.get_test_client() create_file(get_source_path('hello.html'), u'Hello {{ who }}!') resp = t.get('/hello.html?who=world') assert resp.status_code == HTTP_OK assert resp.data.decode() == 'Hello world!' assert resp.mimetype == 'text/html'
def test_values_as_template_context(): c = Clay(TESTS) t = c.get_test_client() create_file(get_source_path('hello.html'), u'Hello {{ who }}!') resp = t.get('/hello.html?who=world') assert resp.status_code == HTTP_OK assert resp.data == 'Hello world!' assert resp.mimetype == 'text/html'
def test_settings_as_template_context(): c = Clay(TESTS, {'who': u'world'}) t = c.get_test_client() create_file(get_source_path('hello.html'), u'Hello {{ who }}!') resp = t.get('/hello.html') assert resp.status_code == HTTP_OK assert resp.data == 'Hello world!' assert resp.mimetype == 'text/html'
def test_settings_as_template_build_context(): c = Clay(TESTS, {'who': u'world', 'FILTER_PARTIALS': False}) t = c.get_test_client() name = 'test.txt.tmpl' sp = get_source_path(name) bp = get_build_path('test.txt') create_file(sp, u'Hello {{ who }}!') c.build_page(name) assert read_content(bp) == u'Hello world!'