diff options
author | lain <lain@soykaf.club> | 2019-09-30 13:57:54 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-09-30 13:57:54 +0200 |
commit | b923842e96e821afeb7bbfa0d098b9c5698281c5 (patch) | |
tree | 37d84255d7b97fc411f5c78378565a8f205a2120 /test/web/common_api/common_api_test.exs | |
parent | 6fe2f554c36be1ef03ac1d1104a78d0686f48a26 (diff) | |
parent | 74d8fadf3745a4b4203c2cead35b741554ccc439 (diff) | |
download | pleroma-b923842e96e821afeb7bbfa0d098b9c5698281c5.tar.gz |
Merge remote-tracking branch 'origin/develop' into reactions
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-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 7cb1202fc..011fcfca9 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -524,4 +524,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 |