From b3e56731741f817c20fe92503c2ca870ef7039b8 Mon Sep 17 00:00:00 2001 From: sarayourfriend Date: Tue, 16 Jul 2024 10:10:07 +1000 Subject: [PATCH] Update pook to v2 (#4582) * Update API pook to v2 and address breaking changes * Update catalog pook to v2 * Upgrade indexer worker pook to v2 --- api/pdm.lock | 10 +++++----- api/pyproject.toml | 2 +- api/test/unit/utils/test_watermark.py | 2 +- api/test/unit/utils/test_waveform.py | 2 +- api/test/unit/views/test_image_views.py | 2 +- catalog/requirements-dev.txt | 2 +- indexer_worker/pdm.lock | 8 ++++---- indexer_worker/pyproject.toml | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/api/pdm.lock b/api/pdm.lock index 96226e1644f..ea134ea8cc9 100644 --- a/api/pdm.lock +++ b/api/pdm.lock @@ -4,8 +4,8 @@ [metadata] groups = ["default", "dev", "overrides", "test"] strategy = ["cross_platform", "inherit_metadata"] -lock_version = "4.4.1" -content_hash = "sha256:91e8af4c323c960f6fa1eac0dd89ffaba079b5e4696f4e58a39b01943a021986" +lock_version = "4.4.2" +content_hash = "sha256:72eb89318bd54e3a8e02fc09eb12c405311b08827f0956b307fe9b154fb108a1" [[package]] name = "adrf" @@ -1264,7 +1264,7 @@ files = [ [[package]] name = "pook" -version = "1.4.3" +version = "2.0.0" requires_python = ">=3.8" summary = "HTTP traffic mocking and expectations made easy" groups = ["test"] @@ -1274,8 +1274,8 @@ dependencies = [ "xmltodict>=0.11.0", ] files = [ - {file = "pook-1.4.3-py3-none-any.whl", hash = "sha256:4683a8a9d11fb56901ae15001a5bfb76a1bb960b1a841de1f0ca11c8c2d9eef8"}, - {file = "pook-1.4.3.tar.gz", hash = "sha256:61dbd9f6f9bf4d0bbab4abdf382bf7e8fbaae8561c5de3cd444e7c4be67df651"}, + {file = "pook-2.0.0-py3-none-any.whl", hash = "sha256:b3993cf00b8335f19b407fca39febd048c97749eb7c06eaddd9fbaff3b0a1ac3"}, + {file = "pook-2.0.0.tar.gz", hash = "sha256:b106ebc088417fa7b68d1f6ee21a9720fd171ea96d4b86ef308eaffac1e5c4f8"}, ] [[package]] diff --git a/api/pyproject.toml b/api/pyproject.toml index 7085f46c2ee..5e9e7301be5 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -57,7 +57,7 @@ test = [ "factory-boy >=3.3.0, <4", "fakeredis >=2.21.3, <3", "freezegun >=1.4.0, <2", - "pook >=1.4.3, <2", + "pook >=2, <3", "pytest >=7.4.4, <8", "pytest-django >=4.8.0, <5", "pytest-pook>=1.0.0", diff --git a/api/test/unit/utils/test_watermark.py b/api/test/unit/utils/test_watermark.py index 0dd4375e034..1266e8bb643 100644 --- a/api/test/unit/utils/test_watermark.py +++ b/api/test/unit/utils/test_watermark.py @@ -19,7 +19,7 @@ def mock_request(): pook.get("http://example.com/") .header("User-Agent", HEADERS["User-Agent"]) .reply(200) - .body(_MOCK_IMAGE_BYTES, binary=True) + .body(_MOCK_IMAGE_BYTES) .mock ) yield mock diff --git a/api/test/unit/utils/test_waveform.py b/api/test/unit/utils/test_waveform.py index e0aefbfd5a9..6929884f2ea 100644 --- a/api/test/unit/utils/test_waveform.py +++ b/api/test/unit/utils/test_waveform.py @@ -20,7 +20,7 @@ def mock_request(): .header("User-Agent", UA_STRING) .reply(200) .headers({"Content-Type": _MOCK_AUDIO_INFO["headers"]["Content-Type"]}) - .body(_MOCK_AUDIO_BYTES, binary=True) + .body(_MOCK_AUDIO_BYTES) .mock ) yield mock diff --git a/api/test/unit/views/test_image_views.py b/api/test/unit/views/test_image_views.py index 0fe9aa82aa9..dd3e8dd667a 100644 --- a/api/test/unit/views/test_image_views.py +++ b/api/test/unit/views/test_image_views.py @@ -26,7 +26,7 @@ def test_oembed_sends_ua_header(api_client): pook.get(image.url) .header("User-Agent", ImageViewSet.OEMBED_HEADERS["User-Agent"]) .reply(200) - .body(_MOCK_IMAGE_BYTES, binary=True) + .body(_MOCK_IMAGE_BYTES) ) res = api_client.get("/v1/images/oembed/", data={"url": image.url}) diff --git a/catalog/requirements-dev.txt b/catalog/requirements-dev.txt index 879aabc0cf8..5cb5b0e6e6b 100644 --- a/catalog/requirements-dev.txt +++ b/catalog/requirements-dev.txt @@ -4,7 +4,7 @@ flaky==3.8.1 ipython -pook==1.4.3 +pook==2.0.0 pytest-env pytest-mock pytest-raises==0.11 diff --git a/indexer_worker/pdm.lock b/indexer_worker/pdm.lock index bc96a833de6..02bb39da940 100644 --- a/indexer_worker/pdm.lock +++ b/indexer_worker/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.2" -content_hash = "sha256:e06cea3d5a964ee0ab5c99e846456c4d897d5495318f5967270fe44bee0b7204" +content_hash = "sha256:1319df2858ab19f749afe3bf93994b90185523c61b047e5b9eb7615e20a5ea33" [[package]] name = "asttokens" @@ -432,7 +432,7 @@ files = [ [[package]] name = "pook" -version = "1.4.3" +version = "2.0.0" requires_python = ">=3.8" summary = "HTTP traffic mocking and expectations made easy" groups = ["dev"] @@ -442,8 +442,8 @@ dependencies = [ "xmltodict>=0.11.0", ] files = [ - {file = "pook-1.4.3-py3-none-any.whl", hash = "sha256:4683a8a9d11fb56901ae15001a5bfb76a1bb960b1a841de1f0ca11c8c2d9eef8"}, - {file = "pook-1.4.3.tar.gz", hash = "sha256:61dbd9f6f9bf4d0bbab4abdf382bf7e8fbaae8561c5de3cd444e7c4be67df651"}, + {file = "pook-2.0.0-py3-none-any.whl", hash = "sha256:b3993cf00b8335f19b407fca39febd048c97749eb7c06eaddd9fbaff3b0a1ac3"}, + {file = "pook-2.0.0.tar.gz", hash = "sha256:b106ebc088417fa7b68d1f6ee21a9720fd171ea96d4b86ef308eaffac1e5c4f8"}, ] [[package]] diff --git a/indexer_worker/pyproject.toml b/indexer_worker/pyproject.toml index 1f4d4746da8..35eef4c3c13 100644 --- a/indexer_worker/pyproject.toml +++ b/indexer_worker/pyproject.toml @@ -36,7 +36,7 @@ dev = [ "pytest-order~=1.1", "pytest-sugar~=0.9", "remote-pdb~=2.1", - "pook~=1.0", + "pook~=2.0", ] [build-system]