Exemple #1
0
def test_template_css():
    t = Template("{% extends base %}")
    t.add_panel('A', 1)
    css = ".test { color: 'green' }"
    ntf = NamedTemporaryFile()
    with open(ntf.name, 'w') as f:
        f.write(css)
    t.add_variable('template_css_files', [ntf.name])

    server = serve(t, port=5009, threaded=True, show=False)

    # Wait for server to start
    time.sleep(1)

    r = requests.get("http://localhost:5009/")
    assert css in r.content.decode('utf-8')
    server.stop()
Exemple #2
0
def test_template_css():
    t = Template("{% extends base %}")
    t.add_panel('A', 1)
    css = ".test { color: 'green' }"
    ntf = NamedTemporaryFile()
    with open(ntf.name, 'w') as f:
        f.write(css)
    t.add_variable('template_css_files', [ntf.name])

    loop = IOLoop()
    server = StoppableThread(target=t._get_server,
                             io_loop=loop,
                             args=(5009, None, None, loop, False, True, None,
                                   False, None))
    server.start()

    # Wait for server to start
    time.sleep(1)

    r = requests.get("http://localhost:5009/")
    assert css in r.content.decode('utf-8')
    server.stop()