def test_read_config_yaml_io(): actual = util.read_config_yaml(StringIO(GOOD_CONFIG_YAML)) assert set(actual.keys()) == set(["host", "port", "database", "user", "password"]) assert actual["host"] == "my.redshift.cluster.com" assert actual["port"] == 1234 assert actual["database"] == "db" assert actual["user"] == "userid" assert actual["password"] == "pass"
def test_read_config_yaml_good(): actual = util.read_config_yaml("filename.yml") assert set(actual.keys()) == set(["host", "port", "database", "user", "password"]) assert actual["host"] == "my.redshift.cluster.com" assert actual["port"] == 1234 assert actual["database"] == "db" assert actual["user"] == "userid" assert actual["password"] == "pass"
def test_read_config_yaml_no_file(): with pytest.raises(CredentialsError): util.read_config_yaml("file_that_does_not_exist.yml")