def test_cli_about_coverage(capsys): sys.argv = ["wetterdienst", "dwd", "about", "coverage"] cli.run() stdout, stderr = capsys.readouterr() response = stdout assert "minute_1" in response assert "precipitation" in response
def test_cli_radar_stations_dwd(capsys): sys.argv = ["wetterdienst", "dwd", "radar", "stations"] cli.run() stdout, stderr = capsys.readouterr() response = json.loads(stdout) assert isinstance(response, list) assert len(response) == 20
def test_cli_radar_stations_opera(capsys): sys.argv = ["wetterdienst", "radar", "stations", "--odim-code=ukdea"] cli.run() stdout, stderr = capsys.readouterr() response = json.loads(stdout) assert isinstance(response, dict) assert response["location"] == "Dean Hill"
def test_cli_about_periods(capsys): sys.argv = ["wetterdienst", "dwd", "about", "periods"] cli.run() stdout, stderr = capsys.readouterr() response = stdout assert "historical" in response assert "recent" in response assert "now" in response
def test_cli_about_resolutions(capsys): sys.argv = ["wetterdienst", "dwd", "about", "resolutions"] cli.run() stdout, stderr = capsys.readouterr() response = stdout assert "1_minute" in response assert "hourly" in response assert "annual" in response
def test_cli_about_parameters(capsys): sys.argv = ["wetterdienst", "dwd", "about", "parameters"] cli.run() stdout, stderr = capsys.readouterr() response = stdout assert "precipitation" in response assert "air_temperature" in response assert "weather_phenomena" in response
def test_cli_help(): with pytest.raises(docopt.DocoptExit) as excinfo: cli.run() response = str(excinfo.value) assert "wetterdienst dwd observation stations" in response assert "wetterdienst dwd observation values" in response assert "wetterdienst dwd forecast stations" in response assert "wetterdienst dwd forecast values" in response assert "wetterdienst dwd about" in response
def invoke_wetterdienst_stations_empty(setting, fmt="json"): argv = shlex.split( f"wetterdienst dwd {setting} --station=123456 --format={fmt}") sys.argv = argv cli.run()
def invoke_wetterdienst_values_geo(setting, fmt="json"): argv = shlex.split( f"wetterdienst dwd {setting} --latitude=51.1280 --longitude=13.7543 --rank=5 " f"--format={fmt}") sys.argv = argv cli.run()
def invoke_wetterdienst_values_static_tidy(setting, station, fmt="json"): argv = shlex.split( f"wetterdienst dwd {setting} --station={station} --format={fmt} --tidy" ) sys.argv = argv cli.run()
def invoke_wetterdienst_values_export(setting, station, target): argv = shlex.split( f"wetterdienst dwd {setting} --station={station} --target={target}") sys.argv = argv cli.run()