test_activity.py 575 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
from funkwhale_api.users.serializers import UserActivitySerializer
from funkwhale_api.favorites import serializers



def test_get_track_activity_url_mbid(factories):
    track = factories['music.Track']()
    expected = 'https://musicbrainz.org/recording/{}'.format(
        track.mbid)
    assert track.get_activity_url() == expected


def test_get_track_activity_url_no_mbid(settings, factories):
    track = factories['music.Track'](mbid=None)
    expected = settings.FUNKWHALE_URL + '/tracks/{}'.format(
        track.pk)
    assert track.get_activity_url() == expected