kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
test(search): Adopt test do use same serializer as view
rodzic
4b1baec347
commit
e8b7da9744
|
@ -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
|
||||
|
||||
|
|
|
@ -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"})
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue