Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Oct 18, 2024
1 parent 7a854f3 commit 7c6c80f
Showing 1 changed file with 14 additions and 26 deletions.
40 changes: 14 additions & 26 deletions tests/test_40_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@

from cads_api_client import Results

RESULTS_URL = "http://localhost:8080/api/retrieve/v1/jobs/bcfc677f-2a4e-4e83-91da-7d1c0340f407/results"


def make_results(size: int = 1) -> Results:
results_json = {
"asset": {
"value": {
"type": "application/x-grib",
"href": f"http://httpbin.org/bytes/{size}",
"file:size": size,
}
RESULTS_URL = "http://localhost:8080/api/retrieve/v1/jobs/9bfc1362-2832-48e1-a235-359267420bb2/results"
RESULTS_JSON = {
"asset": {
"value": {
"type": "application/x-grib",
"href": "http://httpbin.org/bytes/1",
"file:size": 1,
}
}
}


@pytest.fixture
def results() -> Results:
with responses.RequestsMock() as rsps:
rsps.add(
responses.GET,
RESULTS_URL,
json=results_json,
json=RESULTS_JSON,
status=200,
content_type="application/json",
)
Expand All @@ -42,11 +43,6 @@ def make_results(size: int = 1) -> Results:
return results


@pytest.fixture
def results() -> Results:
return make_results()


@pytest.mark.parametrize("target", ("dummy.grib", None))
def test_results_download(
monkeypatch: pytest.MonkeyPatch,
Expand Down Expand Up @@ -77,15 +73,7 @@ def test_results_content_type(results: Results) -> None:


def test_results_json(results: Results) -> None:
assert results.json == {
"asset": {
"value": {
"type": "application/x-grib",
"href": "http://httpbin.org/bytes/1",
"file:size": 1,
}
}
}
assert results.json == RESULTS_JSON


def test_results_location(results: Results) -> None:
Expand Down

0 comments on commit 7c6c80f

Please sign in to comment.