Commit b9231c54 authored by Bruno Duyé's avatar Bruno Duyé
Browse files

Fix test_fetch_series_by_api_link test (the link was broken; added a cassette)

parent 6887c04a
Pipeline #229030 passed with stage
in 49 seconds
......@@ -162,23 +162,6 @@ def test_fetch_series_of_dataset():
assert len(series_codes) > 1
def test_fetch_series_by_api_link():
df = fetch_series_by_api_link(
default_api_base_url +
"/series/BIS/PP-SS?dimensions=%7B%22FREQ%22%3A%5B%22Q%22%5D%2C%22REF_AREA%22%3A%5B%22AU%22%5D%7D&observations=1")
provider_codes = df["provider_code"].unique()
assert len(provider_codes) == 1
assert provider_codes[0] == "BIS"
dataset_codes = df["dataset_code"].unique()
assert len(dataset_codes) == 1
assert dataset_codes[0] == "PP-SS"
series_codes = df["series_code"].unique()
assert len(series_codes)
def test_fetch_series_with_na_values():
df = fetch_series('AMECO', 'ZUTN', 'DEU.1.0.0.0.ZUTN')
assert "NA" in list(df.original_value)
......@@ -232,6 +215,26 @@ def test_fetch_series_with_filter_on_one_series_with_wrong_frequency(caplog):
# --- Tests above uses VCR.py (https://vcrpy.readthedocs.io/en/latest/usage.html) to load fixtures ---
@pytest.mark.vcr(decode_compressed_response=True)
def test_fetch_series_by_api_link():
# import requests
# pytest.mark.vcr(aefafeaf=True, decode_compressed_respons=True)
# assert requests.get("http://httpbin.org/get").url == 'http://httpbin.org/get'
df = fetch_series_by_api_link(
default_api_base_url +
"/series/BIS/xru_current?dimensions=%7B%22FREQ%22%3A%5B%22M%22%5D%2C%22REF_AREA%22%3A%5B%22AL%22%5D%2C%22COLLECTION%22%3A%5B%22E%22%5D%7D&observations=1")
provider_codes = df["provider_code"].unique()
assert len(provider_codes) == 1
assert provider_codes[0] == "BIS"
dataset_codes = df["dataset_code"].unique()
assert len(dataset_codes) == 1
assert dataset_codes[0] == "xru_current"
series_codes = df["series_code"].unique()
assert len(series_codes)
@pytest.mark.vcr(decode_compressed_response=True)
def test_fetch_series_without_dimensions_labels():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment