Example #1
0
def test_plugin_order_good():
    config = {"plugins": [moduletest,
                          pluginorder]}

    (_, _, stderr) = fixture.run_tangelo("--config", json.dumps(config), timeout=3, terminate=True)
    stderr = "\n".join(stderr)

    assert "Plugin can reference tangelo.plugin.moduletest True" in stderr
Example #2
0
def test_plugin_order_bad():
    config = {"plugins": [pluginorder,
                          moduletest]}

    (_, _, stderr) = fixture.run_tangelo("--config", json.dumps(config), timeout=3, terminate=True)
    stderr = "\n".join(stderr)

    assert "Plugin pluginorder failed to load" in stderr
Example #3
0
def test_error_code():
    (_, _, stderr, result) = fixture.run_tangelo("--host", fixture.host, "--port", fixture.port, "--root", "tests/web",
                                                 timeout=5, terminate=True, action=bad_service)

    logcode = filter(lambda x: "SERVICE" in x, stderr)[0][-10:-4]
    reportcode = result.json()["message"].split()[2]

    assert logcode == reportcode
Example #4
0
def test_lower_verbosity():
    (_, _, stderr) = fixture.run_tangelo("-q",
                                         "--port",
                                         "30047",
                                         timeout=3,
                                         terminate=True)

    assert len(stderr) == 0
Example #5
0
def test_inline_config():
    config = {"plugins": [{"name": "ui"}]}
    (_, _, stderr) = fixture.run_tangelo("-c", json.dumps(config), terminate=True)
    stderr = "\n".join(stderr)

    print stderr

    assert "Server is running" in stderr
    assert "Plugin ui loaded" in stderr
Example #6
0
def test_standard_verbosity():
    (_, _, stderr) = fixture.run_tangelo("--port",
                                         "30047",
                                         timeout=3,
                                         terminate=True)
    stderr = "\n".join(stderr)

    assert "Server is running" in stderr
    assert "Hostname" in stderr
def test_config_wrong_type_settings():
    config = {"server_settings": "Angosian"}
    (_, _, stderr) = fixture.run_tangelo(
        "-c", json.dumps(config), terminate=True)
    stderr = "\n".join(stderr)

    print stderr

    assert "option server_settings must be of type dict" in stderr
Example #8
0
def test_plugin_module():
    config = {"plugins": [{
        "name": "moduletest",
        "path": "tests/plugins/moduletest"
    }]}
    (_, _, stderr) = fixture.run_tangelo("--config", json.dumps(config), timeout=3, terminate=True)
    stderr = "\n".join(stderr)

    assert "Plugin has value server.TestConstant True" in stderr
Example #9
0
def test_plugin_single_file():
    config = {"plugins": [{
        "name": "pythonfile",
        "path": "tests/plugins/pythonfile"
    }]}
    (_, _, stderr) = fixture.run_tangelo("--config", json.dumps(config), timeout=3, terminate=True)
    stderr = "\n".join(stderr)

    assert "Python file plugin" in stderr
Example #10
0
def test_plugin_order_bad():
    config = {"plugins": [pluginorder, moduletest]}

    (_, _, stderr) = fixture.run_tangelo("--config",
                                         json.dumps(config),
                                         timeout=3,
                                         terminate=True)
    stderr = "\n".join(stderr)

    assert "Plugin pluginorder failed to load" in stderr
Example #11
0
def test_plugin_order_good():
    config = {"plugins": [moduletest, pluginorder]}

    (_, _, stderr) = fixture.run_tangelo("--config",
                                         json.dumps(config),
                                         timeout=3,
                                         terminate=True)
    stderr = "\n".join(stderr)

    assert "Plugin can reference tangelo.plugin.moduletest True" in stderr
Example #12
0
def test_config_wrong_type_settings():
    config = {"server_settings": "Angosian"}
    (_, _, stderr) = fixture.run_tangelo("-c",
                                         json.dumps(config),
                                         terminate=True)
    stderr = "\n".join(stderr)

    print stderr

    assert "option server_settings must be of type dict" in stderr
Example #13
0
def test_bad_config():
    (code, stdout, stderr) = fixture.run_tangelo("-c", "tests/config/bad-config.yaml")

    signal = "ERROR while parsing"

    print "Expected: '%s' in third line of log" % (signal)
    print "Received: %s" % (stderr[2] if len(stderr) > 2 else "")

    assert len(stderr) > 1
    assert signal in stderr[2]
Example #14
0
def test_non_dict_config():
    (code, stdout, stderr) = fixture.run_tangelo("-c", "tests/config/list-config.yaml")

    signal = "does not contain associative array"

    print "Expected: '%s' in third line of log" % (signal)
    print "Received: %s" % (stderr[2] if len(stderr) > 1 else "")

    assert len(stderr) > 1
    assert signal in stderr[2]
Example #15
0
def test_commandline_version():
    (code, stdout, stderr) = fixture.run_tangelo("--version")
    expected = "0.10.0"

    print "Expected: %s" % (expected)
    print "Received: %s" % ("\n".join(stdout))

    assert code == 0
    assert stderr == []
    assert len(stdout) == 1 and stdout[0] == expected
Example #16
0
def test_bad_config():
    (code, stdout,
     stderr) = fixture.run_tangelo("-c", "tests/config/bad-config.yaml")

    signal = "ERROR while parsing"

    print "Expected: '%s' in third line of log" % (signal)
    print "Received: %s" % (stderr[2] if len(stderr) > 2 else "")

    assert len(stderr) > 1
    assert signal in stderr[2]
Example #17
0
def test_inline_config():
    config = {"plugins": [{"name": "ui"}]}
    (_, _, stderr) = fixture.run_tangelo("-c",
                                         json.dumps(config),
                                         terminate=True)
    stderr = "\n".join(stderr)

    print stderr

    assert "Server is running" in stderr
    assert "Plugin ui loaded" in stderr
Example #18
0
def test_non_dict_config():
    (code, stdout,
     stderr) = fixture.run_tangelo("-c", "tests/config/list-config.yaml")

    signal = "does not contain associative array"

    print "Expected: '%s' in third line of log" % (signal)
    print "Received: %s" % (stderr[2] if len(stderr) > 1 else "")

    assert len(stderr) > 1
    assert signal in stderr[2]
Example #19
0
def test_plugin_single_file():
    config = {
        "plugins": [{
            "name": "pythonfile",
            "path": "tests/plugins/pythonfile"
        }]
    }
    (_, _, stderr) = fixture.run_tangelo("--config",
                                         json.dumps(config),
                                         timeout=3,
                                         terminate=True)
    stderr = "\n".join(stderr)

    assert "Python file plugin" in stderr
Example #20
0
def test_plugin_module():
    config = {
        "plugins": [{
            "name": "moduletest",
            "path": "tests/plugins/moduletest"
        }]
    }
    (_, _, stderr) = fixture.run_tangelo("--config",
                                         json.dumps(config),
                                         timeout=3,
                                         terminate=True)
    stderr = "\n".join(stderr)

    assert "Plugin has value server.TestConstant True" in stderr
Example #21
0
def test_error_code():
    (_, _, stderr, result) = fixture.run_tangelo("--host",
                                                 fixture.host,
                                                 "--port",
                                                 fixture.port,
                                                 "--root",
                                                 "tests/web",
                                                 timeout=5,
                                                 terminate=True,
                                                 action=bad_service)

    logcode = filter(lambda x: "SERVICE" in x, stderr)[0][-10:-4]
    reportcode = result.json()["message"].split()[2]

    assert logcode == reportcode
Example #22
0
def test_lower_verbosity():
    (_, _, stderr) = fixture.run_tangelo("-q", "--port", "30047", timeout=3, terminate=True)

    assert len(stderr) == 0
Example #23
0
def test_standard_verbosity():
    (_, _, stderr) = fixture.run_tangelo("--port", "30047", timeout=3, terminate=True)
    stderr = "\n".join(stderr)

    assert "Server is running" in stderr
    assert "Hostname" in stderr