diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-09-30 17:41:20 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-09-30 17:41:20 +0300 |
commit | 6ffa2b5f661c2db424334c6fb5de6f4d1bfeb745 (patch) | |
tree | dd1b2129f3eb7df7b0141cc65ba6c492a36863d0 /test/web/common_api/common_api_test.exs | |
parent | c98e761d28812818971d327800f1fc4c2baa2dbc (diff) | |
parent | a22a7437d84065192601f73da73d2c27111c9b15 (diff) | |
download | pleroma-6ffa2b5f661c2db424334c6fb5de6f4d1bfeb745.tar.gz pleroma-6ffa2b5f661c2db424334c6fb5de6f4d1bfeb745.zip |
[#1260] Merge remote-tracking branch 'remotes/upstream/develop' into 1260-rate-limited-auth-actions
# Conflicts:
# CHANGELOG.md
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 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 |