def test_05_run_output_file(): output_file = os.path.join(tempfile.gettempdir(), "out") main = Main(__file__, CONF_DIR, ("--output-file=%s env" % output_file).split()) main.run() try: f = open(output_file) assert "BTFLY_HOSTS=(web01 db01 db02 db03)" == "".join(f.readlines()).rstrip(),\ "run > --output-file" finally: f.close()
def test_02_run_validation_errors(): with pytest.raises(RuntimeError): out = StringIO() conf_path = os.path.join(TESTS_DIR, 'invalid_duplicated_statuses.yaml') main = Main(__file__, CONF_DIR, ("--conf=%s env" % (conf_path)).split()) main.run(out)
def test_04_run_tag_not_defined(): with pytest.raises(ValueError): out = StringIO() main = Main(__file__, CONF_DIR, "--tags=foobar env".split()) main.run(out)
def test_01_run(): out = StringIO() main = Main(__file__, CONF_DIR, "env".split()) main.run(out) assert "BTFLY_HOSTS=(web01 db01 db02 db03)" == out.getvalue().rstrip(), "run"