diff options
| author | Mark Felder <feld@FreeBSD.org> | 2020-10-13 10:08:38 -0500 | 
|---|---|---|
| committer | Mark Felder <feld@FreeBSD.org> | 2020-10-13 10:08:38 -0500 | 
| commit | b738f709532ff18845f5d8cc3888d0bd67f750ab (patch) | |
| tree | 87596ad2bf711bdbc3dc75293996157c3c99d955 /test/web/activity_pub/transmogrifier/audio_handling_test.exs | |
| parent | c4fae2611ff4da7c418de236fa643021ddc778c8 (diff) | |
| parent | 8b6221d4ecd1d7e354e7de831dd46e285cb85077 (diff) | |
| download | pleroma-b738f709532ff18845f5d8cc3888d0bd67f750ab.tar.gz pleroma-b738f709532ff18845f5d8cc3888d0bd67f750ab.zip  | |
Merge branch 'develop' into feature/gen-magic
Diffstat (limited to 'test/web/activity_pub/transmogrifier/audio_handling_test.exs')
| -rw-r--r-- | test/web/activity_pub/transmogrifier/audio_handling_test.exs | 83 | 
1 files changed, 0 insertions, 83 deletions
diff --git a/test/web/activity_pub/transmogrifier/audio_handling_test.exs b/test/web/activity_pub/transmogrifier/audio_handling_test.exs deleted file mode 100644 index 0636d00c5..000000000 --- a/test/web/activity_pub/transmogrifier/audio_handling_test.exs +++ /dev/null @@ -1,83 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.ActivityPub.Transmogrifier.AudioHandlingTest do -  use Oban.Testing, repo: Pleroma.Repo -  use Pleroma.DataCase - -  alias Pleroma.Activity -  alias Pleroma.Object -  alias Pleroma.Web.ActivityPub.Transmogrifier - -  import Pleroma.Factory - -  test "it works for incoming listens" do -    _user = insert(:user, ap_id: "http://mastodon.example.org/users/admin") - -    data = %{ -      "@context" => "https://www.w3.org/ns/activitystreams", -      "to" => ["https://www.w3.org/ns/activitystreams#Public"], -      "cc" => [], -      "type" => "Listen", -      "id" => "http://mastodon.example.org/users/admin/listens/1234/activity", -      "actor" => "http://mastodon.example.org/users/admin", -      "object" => %{ -        "type" => "Audio", -        "id" => "http://mastodon.example.org/users/admin/listens/1234", -        "attributedTo" => "http://mastodon.example.org/users/admin", -        "title" => "lain radio episode 1", -        "artist" => "lain", -        "album" => "lain radio", -        "length" => 180_000 -      } -    } - -    {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - -    object = Object.normalize(activity) - -    assert object.data["title"] == "lain radio episode 1" -    assert object.data["artist"] == "lain" -    assert object.data["album"] == "lain radio" -    assert object.data["length"] == 180_000 -  end - -  test "Funkwhale Audio object" do -    Tesla.Mock.mock(fn -      %{url: "https://channels.tests.funkwhale.audio/federation/actors/compositions"} -> -        %Tesla.Env{ -          status: 200, -          body: File.read!("test/fixtures/tesla_mock/funkwhale_channel.json") -        } -    end) - -    data = File.read!("test/fixtures/tesla_mock/funkwhale_create_audio.json") |> Poison.decode!() - -    {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - -    assert object = Object.normalize(activity, false) - -    assert object.data["to"] == ["https://www.w3.org/ns/activitystreams#Public"] - -    assert object.data["cc"] == [] - -    assert object.data["url"] == "https://channels.tests.funkwhale.audio/library/tracks/74" - -    assert object.data["attachment"] == [ -             %{ -               "mediaType" => "audio/ogg", -               "type" => "Link", -               "name" => nil, -               "url" => [ -                 %{ -                   "href" => -                     "https://channels.tests.funkwhale.audio/api/v1/listen/3901e5d8-0445-49d5-9711-e096cf32e515/?upload=42342395-0208-4fee-a38d-259a6dae0871&download=false", -                   "mediaType" => "audio/ogg", -                   "type" => "Link" -                 } -               ] -             } -           ] -  end -end  | 
