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
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
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
def test_lower_verbosity(): (_, _, stderr) = fixture.run_tangelo("-q", "--port", "30047", timeout=3, terminate=True) assert len(stderr) == 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
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
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
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
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
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]
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]
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
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
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