From c072f67a4a417a8d4b82347bac417c7fb3202ee8 Mon Sep 17 00:00:00 2001 From: Petitminion Date: Tue, 3 Jun 2025 16:58:17 +0200 Subject: [PATCH] romove unused code --- api/funkwhale_api/federation/contexts.py | 17 ----- api/tests/federation/test_tasks.py | 84 ------------------------ 2 files changed, 101 deletions(-) diff --git a/api/funkwhale_api/federation/contexts.py b/api/funkwhale_api/federation/contexts.py index 6efa06ed9..5ea7ae4d4 100644 --- a/api/funkwhale_api/federation/contexts.py +++ b/api/funkwhale_api/federation/contexts.py @@ -359,22 +359,6 @@ CONTEXTS = [ } }, }, - { - "shortId": "MB", - "contextUrl": None, - "documentUrl": "http://musicbrainz.org/ns/mmd-1.0#", - "document": { - "@context": { - "mb": "http://musicbrainz.org/ns/mmd-1.0#", - "schema": "http://schema.org#", - "Recording": "schema:MusicRecording", - "name": "schema:name", - "duration": "schema:duration", - "@id": "@id", - "@type": "@type", - }, - }, - }, ] CONTEXTS_BY_ID = {c["shortId"]: c for c in CONTEXTS} @@ -408,4 +392,3 @@ SEC = NS(CONTEXTS_BY_ID["SEC"]) FW = NS(CONTEXTS_BY_ID["FW"]) SC = NS(CONTEXTS_BY_ID["SC"]) LITEPUB = NS(CONTEXTS_BY_ID["LITEPUB"]) -MB = NS(CONTEXTS_BY_ID["MB"]) diff --git a/api/tests/federation/test_tasks.py b/api/tests/federation/test_tasks.py index f7c7aa6e7..ef48374b4 100644 --- a/api/tests/federation/test_tasks.py +++ b/api/tests/federation/test_tasks.py @@ -736,87 +736,3 @@ def test_fetch_webfinger_create_actor(factories, r_mock, mocker): assert init.call_args[0][1] == actor assert init.call_args[1]["data"] == payload assert save.call_count == 1 - - -def test_third_party_fetch_success(factories, r_mock, mocker): - track = factories["music.Track"]() - url = f"https://musicbrainz.org/recording/{track.mbid}" - fetch = factories["federation.Fetch"](url=url) - payload = { - "releases": [ - { - "status": "Promotion", - "id": "220ffb88-49ed-4df4-a330-46f8e7353ff0", - "country": "DE", - "title": "With Oi! To Hope for Myanmar 2022", - "quality": "normal", - "release-events": [ - { - "area": { - "name": "Germany", - "id": "85752fda-13c4-31a3-bee5-0e5cb1f51dad", - "sort-name": "Germany", - "disambiguation": "", - "iso-3166-1-codes": ["DE"], - }, - "date": "2022", - } - ], - "disambiguation": "Version aus 2022", - "status-id": "518ffc83-5cde-34df-8627-81bff5093d92", - "packaging-id": "8f931351-d2e2-310f-afc6-37b89ddba246", - "artist-credit": [ - { - "artist": { - "sort-name": "Various Artists", - "name": "Various Artists", - "disambiguation": "add compilations to this artist", - "type": "Other", - "type-id": "ac897045-5043-3294-969b-187360e45d86", - "id": "89ad4ac3-39f7-470e-963a-56509c546377", - }, - "joinphrase": "", - "name": "Various Artists", - } - ], - "barcode": "", - "date": "2022", - "packaging": "Digipak", - "text-representation": {"language": "mul", "script": "Latn"}, - } - ], - "disambiguation": "", - "video": False, - "first-release-date": "2022", - "artist-credit": [ - { - "artist": { - "name": "The Rebel Riot", - "disambiguation": "", - "sort-name": "Rebel Riot, The", - "type": "Group", - "id": "1ff2cd0c-2ac1-4296-b650-77ef57bb0d01", - "country": "MM", - "type-id": "e431f5f6-b5d2-343d-8b36-72607fffb74b", - }, - "name": "The Rebel Riot", - "joinphrase": "", - } - ], - "title": "A.C.A.B.", - "id": "455cd030-7394-4244-9a53-3b96a666b1c6", - "length": 193253, - } - init = mocker.spy(serializers.ArtistSerializer, "__init__") - save = mocker.spy(serializers.ArtistSerializer, "save") - - r_mock.get(url, json=payload) - - tasks.third_party_fetch(fetch_id=fetch.pk) - - fetch.refresh_from_db() - - assert fetch.status == "finished" - assert init.call_count == 1 - assert init.call_args[1]["data"] == payload - assert save.call_count == 1