Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Revert "Fix related media endpoint (#808)"
Browse files Browse the repository at this point in the history
This reverts commit d7962f1.
  • Loading branch information
sarayourfriend committed Aug 5, 2022
1 parent 596d627 commit 60dc9f2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 26 deletions.
10 changes: 1 addition & 9 deletions api/catalog/api/controllers/elasticsearch/related.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging

from elasticsearch_dsl import Search
from elasticsearch_dsl.response import Hit

from catalog.api.controllers.elasticsearch.utils import (
exclude_filtered_providers,
Expand Down Expand Up @@ -52,16 +51,9 @@ def related_media(uuid, index, filter_dead):

result_count, _ = get_result_and_page_count(response, results, page_size)

dumpable_results = (
results.to_dict()
if isinstance(results, Hit)
else [r.to_dict() for r in results]
)

logger.debug(
"finished post processing and returning related "
f"result_count={result_count} "
f"results={json.dumps(dumpable_results)}"
f"results={json.dumps(results)}"
)

return results, result_count
2 changes: 1 addition & 1 deletion api/catalog/api/controllers/elasticsearch/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def perform_search(
dumpable_results = (
results.to_dict()
if isinstance(results, Hit)
else [r.to_dict() for r in results]
else list(map(lambda r: r.to_dict(), results))
)

logger.debug(
Expand Down
5 changes: 0 additions & 5 deletions api/test/audio_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from test.media_integration import (
detail,
license_filter_case_insensitivity,
related,
report,
search,
search_all_excluded,
Expand Down Expand Up @@ -123,7 +122,3 @@ def test_audio_uuid_validation():
uuid_validation("audio", "123456789123456789123456789123456789")
uuid_validation("audio", "12345678-1234-5678-1234-1234567891234")
uuid_validation("audio", "abcd")


def test_image_related(audio_fixture):
related(audio_fixture)
5 changes: 0 additions & 5 deletions api/test/image_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from test.media_integration import (
detail,
license_filter_case_insensitivity,
related,
report,
search,
search_all_excluded,
Expand Down Expand Up @@ -140,7 +139,3 @@ def test_image_uuid_validation():
uuid_validation("images", "123456789123456789123456789123456789")
uuid_validation("images", "12345678-1234-5678-1234-1234567891234")
uuid_validation("images", "abcd")


def test_image_related(image_fixture):
related(image_fixture)
6 changes: 0 additions & 6 deletions api/test/media_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,3 @@ def license_filter_case_insensitivity(media_type):
def uuid_validation(media_type, identifier):
response = requests.get(f"{API_URL}/v1/{media_type}/{identifier}", verify=False)
assert response.status_code == 404


def related(fixture):
related_url = fixture["results"][0]["related_url"]
response = requests.get(related_url)
assert response.status_code == 200

0 comments on commit 60dc9f2

Please sign in to comment.