test(search): Adopt test do use same serializer as view

environments/review-docs-archi-2rzv61/deployments/14145
Georg Krause 2022-10-13 11:46:17 +02:00
rodzic 4b1baec347
commit e8b7da9744
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 2970D504B2183D22
2 zmienionych plików z 9 dodań i 7 usunięć

Wyświetl plik

@ -838,7 +838,7 @@ class Search(views.APIView):
if "in tsquery:" in str(e):
return Response(
{"detail": "Invalid query"}, status=400
) # TODO This might be better a 500?
)
else:
raise

Wyświetl plik

@ -1346,12 +1346,14 @@ def test_search_get(logged_in_api_client, factories):
factories["tags.Tag"]()
url = reverse("api:v1:search")
expected = {
"artists": [serializers.ArtistWithAlbumsSerializer(artist).data],
"albums": [serializers.AlbumSerializer(album).data],
"tracks": [serializers.TrackSerializer(track).data],
"tags": [views.TagSerializer(tag).data],
}
expected = serializers.SearchResultSerializer(
{
"artists": [artist],
"albums": [album],
"tracks": [track],
"tags": [tag],
}
).data
response = logged_in_api_client.get(url, {"q": "foo"})