diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2019-09-28 00:24:32 +0000 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-09-30 10:39:17 +0000 |
commit | 2c82d8603bb4c3f7281023752dc78aa31a814ab6 (patch) | |
tree | b6692c2ad3f90775ce2e869c5895c37ac8c5e231 /test | |
parent | 172c74a77baf5b8910987e19c620158d0497d16a (diff) | |
download | pleroma-2c82d8603bb4c3f7281023752dc78aa31a814ab6.tar.gz |
common api: implement scrobbling
Diffstat (limited to 'test')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index f28a66090..0f4a5eb25 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -510,4 +510,43 @@ defmodule Pleroma.Web.CommonAPITest do assert {:error, "Already voted"} == CommonAPI.vote(other_user, object, [1]) end end + + describe "listen/2" do + test "returns a valid activity" do + user = insert(:user) + + {:ok, activity} = + CommonAPI.listen(user, %{ + "title" => "lain radio episode 1", + "album" => "lain radio", + "artist" => "lain", + "length" => 180_000 + }) + + object = Object.normalize(activity) + + assert object.data["title"] == "lain radio episode 1" + + assert Visibility.get_visibility(activity) == "public" + end + + test "respects visibility=private" do + user = insert(:user) + + {:ok, activity} = + CommonAPI.listen(user, %{ + "title" => "lain radio episode 1", + "album" => "lain radio", + "artist" => "lain", + "length" => 180_000, + "visibility" => "private" + }) + + object = Object.normalize(activity) + + assert object.data["title"] == "lain radio episode 1" + + assert Visibility.get_visibility(activity) == "private" + end + end end |