def test_not_implemented_os(self): with pytest.raises(Exception) as e: mk_postgres.helper_factory().get_default_path() assert "is not yet implemented" in str(e.value) with pytest.raises(Exception) as e: mk_postgres.helper_factory().get_default_postgres_user() assert "is not yet implemented" in str(e.value)
def test_config_with_instance(self, ): config = copy.deepcopy(VALID_CONFIG_WITH_INSTANCES) config[-1] = config[-1].format(sep=SEP_LINUX) sep = mk_postgres.helper_factory().get_conf_sep() dbuser, instances = mk_postgres.parse_postgres_cfg(config, sep) assert dbuser == "user_yz" assert len(instances) == 1 assert instances[0]["pg_port"] == "5432" assert instances[0]["name"] == "db1" assert instances[0]["pg_user"] == "USER_NAME" assert instances[0]["pg_passfile"] == "/PATH/TO/.pgpass"
def test_config_without_instance(self, ): sep = mk_postgres.helper_factory().get_conf_sep() dbuser, instances = mk_postgres.parse_postgres_cfg( VALID_CONFIG_WITHOUT_INSTANCE, sep) assert dbuser == "user_xy" assert len(instances) == 0
def test_get_default_postgres_user(self, ): assert "postgres" == mk_postgres.helper_factory( ).get_default_postgres_user()
def test_get_default_path(self, ): assert "/etc/check_mk" == mk_postgres.helper_factory( ).get_default_path()
def test_get_default_path(self): assert ("c:\\ProgramData\\checkmk\\agent\\config" == mk_postgres.helper_factory().get_default_path())