2018-03-25 15:24:08 +00:00
|
|
|
from funkwhale_api.activity import serializers
|
|
|
|
from funkwhale_api.favorites.serializers import TrackFavoriteActivitySerializer
|
2018-06-09 13:36:16 +00:00
|
|
|
from funkwhale_api.history.serializers import ListeningActivitySerializer
|
2018-03-25 15:24:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_autoserializer(factories):
|
2018-06-09 13:36:16 +00:00
|
|
|
favorite = factories["favorites.TrackFavorite"]()
|
|
|
|
listening = factories["history.Listening"]()
|
2018-03-25 15:24:08 +00:00
|
|
|
objects = [favorite, listening]
|
|
|
|
serializer = serializers.AutoSerializer(objects, many=True)
|
|
|
|
expected = [
|
|
|
|
TrackFavoriteActivitySerializer(favorite).data,
|
|
|
|
ListeningActivitySerializer(listening).data,
|
|
|
|
]
|
|
|
|
|
|
|
|
assert serializer.data == expected
|