示例#1
0
def test_returns_overriden_media():
    server = ServerHelper(root_dir, 'config.ini')

    try:
        exit_code, content = \
            HttpClient.get('http://localhost:8082/media/css/readme.rst')
        assert exit_code == 200
        assert content.strip() == u"Other readme!", content.strip()
    finally:
        server.stop()
示例#2
0
def test_template_filter_for_custom_app_is_loaded():
    server = ServerHelper(root_dir, 'config.ini')

    try:
        exit_code, content = HttpClient.get('http://localhost:8082/hello')
        assert exit_code == 200
        assert "Hello Claudio" in content, \
            "Should contain the text 'Hello Claudio'"
    finally:
        server.stop()
示例#3
0
def test_index_action_returns_overriden_template():
    server = ServerHelper(root_dir, 'config.ini')

    try:
        exit_code, content = HttpClient.get('http://localhost:8082/')
        assert exit_code == 200
        assert "Ptufl" in content

    finally:
        server.stop()
示例#4
0
def test_can_render_template_from_null_template_folder():
    clear()

    class TemplateFolderController(Controller):
        pass

    server = ServerHelper(root_dir, 'controller_config1.ini')

    try:
        controller = server.ctrl(TemplateFolderController)
        content = controller.render_template('test_template.html')

        assert content == "Hello World"
    finally:
        server.stop()
示例#5
0
def test_healthcheck_returns_custom_string_when_no_text_found_in_config():
    clear()

    class HealthCheckController(Controller):
        pass

    server = ServerHelper(root_dir, 'controller_config1.ini')

    try:
        controller = server.ctrl(HealthCheckController)

        content = controller.healthcheck()

        assert content == "CUSTOMTEXT"
    finally:
        server.stop()