Example #1
0
def test_outbox_create_audio_channel(factories, mocker):
    channel = factories["audio.Channel"]()
    upload = factories["music.Upload"](library=channel.library)
    activity = list(routes.outbox_create_audio({"upload": upload}))[0]
    serializer = serializers.ChannelCreateUploadSerializer(upload)
    expected = serializer.data
    expected["to"] = [{
        "type": "followers",
        "target": upload.library.channel.actor
    }]

    assert dict(activity["payload"]) == dict(expected)
    assert activity["actor"] == channel.actor
    assert activity["target"] is None
    assert activity["object"] == upload
Example #2
0
def test_outbox_create_audio(factories, mocker):
    upload = factories["music.Upload"]()
    activity = list(routes.outbox_create_audio({"upload": upload}))[0]
    serializer = serializers.ActivitySerializer({
        "type":
        "Create",
        "object":
        serializers.UploadSerializer(upload).data,
        "actor":
        upload.library.actor.fid,
    })
    expected = serializer.data
    expected["to"] = [{"type": "followers", "target": upload.library}]

    assert dict(activity["payload"]) == dict(expected)
    assert activity["actor"] == upload.library.actor
    assert activity["target"] == upload.library
    assert activity["object"] == upload