Fx #1178: Display channel and track downloads count

This commit is contained in:
Agate 2020-07-31 11:46:25 +02:00
parent 75f9537d89
commit e9186ca813
8 changed files with 30 additions and 3 deletions

View file

@ -213,7 +213,7 @@ def test_channel_serializer_update_podcast(factories):
def test_channel_serializer_representation(factories, to_api_date):
content = factories["common.Content"]()
channel = factories["audio.Channel"](artist__description=content)
setattr(channel, "_downloads_count", 12)
expected = {
"artist": music_serializers.serialize_artist_simple(channel.artist),
"uuid": str(channel.uuid),
@ -225,6 +225,7 @@ def test_channel_serializer_representation(factories, to_api_date):
"metadata": {},
"rss_url": channel.get_rss_url(),
"url": channel.actor.url,
"downloads_count": 12,
}
expected["artist"]["description"] = common_serializers.ContentSerializer(
content
@ -248,6 +249,7 @@ def test_channel_serializer_external_representation(factories, to_api_date):
"metadata": {},
"rss_url": channel.get_rss_url(),
"url": channel.actor.url,
"downloads_count": None,
}
expected["artist"]["description"] = common_serializers.ContentSerializer(
content

View file

@ -234,6 +234,7 @@ def test_track_serializer(factories, to_api_date):
"tags": [],
"attributed_to": federation_serializers.APIActorSerializer(actor).data,
"cover": common_serializers.AttachmentSerializer(track.attachment_cover).data,
"downloads_count": track.downloads_count,
}
serializer = serializers.TrackSerializer(track)
assert serializer.data == expected