from dqc_wrapper import checker
import os
import configparser

def main(n):
    this_dir = os.path.dirname(__file__)
    conf_file = os.path.join(this_dir, f"../conf/conf_test06_{n}.ini")
    checker.main([conf_file])
    config_input = configparser.RawConfigParser()
    config_input.read(conf_file)
    config_output = configparser.RawConfigParser()
    config_output.read(os.path.join(config_input["general"]["res_dir"],
                                    f"conf_test06_{n}.ini"))
    return config_output["valid_ranges_result"]["res"]

def test_nc():
    assert main(5) == "ok"

def test_grib():
    assert main(1) == "ok"

def test_fail():
    assert main(2) == "err"

test_nc()