test(search): Adopt test do use same serializer as view
This commit is contained in:
parent
4b1baec347
commit
e8b7da9744
|
@ -838,7 +838,7 @@ class Search(views.APIView):
|
||||||
if "in tsquery:" in str(e):
|
if "in tsquery:" in str(e):
|
||||||
return Response(
|
return Response(
|
||||||
{"detail": "Invalid query"}, status=400
|
{"detail": "Invalid query"}, status=400
|
||||||
) # TODO This might be better a 500?
|
)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -1346,12 +1346,14 @@ def test_search_get(logged_in_api_client, factories):
|
||||||
factories["tags.Tag"]()
|
factories["tags.Tag"]()
|
||||||
|
|
||||||
url = reverse("api:v1:search")
|
url = reverse("api:v1:search")
|
||||||
expected = {
|
expected = serializers.SearchResultSerializer(
|
||||||
"artists": [serializers.ArtistWithAlbumsSerializer(artist).data],
|
{
|
||||||
"albums": [serializers.AlbumSerializer(album).data],
|
"artists": [artist],
|
||||||
"tracks": [serializers.TrackSerializer(track).data],
|
"albums": [album],
|
||||||
"tags": [views.TagSerializer(tag).data],
|
"tracks": [track],
|
||||||
}
|
"tags": [tag],
|
||||||
|
}
|
||||||
|
).data
|
||||||
|
|
||||||
response = logged_in_api_client.get(url, {"q": "foo"})
|
response = logged_in_api_client.get(url, {"q": "foo"})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue