aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-04-13 16:19:07 +0200
committerRoger Braun <roger@rogerbraun.net>2017-04-13 16:19:07 +0200
commit653d605e14d25658d398148748335dc58f9f2229 (patch)
tree3387a15d347a4a188011aff30a81b418b581b51f /test
parent1388054796feed8f03d659171bbbc0c21056dd2f (diff)
downloadpleroma-653d605e14d25658d398148748335dc58f9f2229.tar.gz
Add favoriting to twitter api.
Diffstat (limited to 'test')
-rw-r--r--test/web/twitter_api/representers/activity_representer_test.exs6
-rw-r--r--test/web/twitter_api/twitter_api_test.exs13
2 files changed, 17 insertions, 2 deletions
diff --git a/test/web/twitter_api/representers/activity_representer_test.exs b/test/web/twitter_api/representers/activity_representer_test.exs
index f1f2b4c9c..70df79a77 100644
--- a/test/web/twitter_api/representers/activity_representer_test.exs
+++ b/test/web/twitter_api/representers/activity_representer_test.exs
@@ -45,7 +45,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
"statusnetConversationId" => 4711,
"attachment" => [
object
- ]
+ ],
+ "like_count" => 5
},
"published" => date
}
@@ -68,7 +69,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
],
"attentions" => [
UserRepresenter.to_map(mentioned_user, %{for: follower})
- ]
+ ],
+ "fave_num" => 5
}
assert ActivityRepresenter.to_map(activity, %{user: user, for: follower, mentioned: [mentioned_user]}) == expected_status
diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs
index a4c9bd7e7..341622758 100644
--- a/test/web/twitter_api/twitter_api_test.exs
+++ b/test/web/twitter_api/twitter_api_test.exs
@@ -5,6 +5,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
alias Pleroma.{Activity, User, Object, Repo}
alias Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter
+ import Pleroma.Factory
+
test "create a status" do
user = UserBuilder.build(%{ap_id: "142344"})
_mentioned_user = UserBuilder.insert(%{nickname: "shp", ap_id: "shp"})
@@ -177,4 +179,15 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
assert TwitterAPI.add_user_links(text, mentions) == expected_text
end
+
+ test "it favorites a status, returns the updated status" do
+ user = insert(:user)
+ note_activity = insert(:note_activity)
+ activity_user = Repo.get_by!(User, ap_id: note_activity.data["actor"])
+
+ {:ok, status} = TwitterAPI.favorite(user, note_activity)
+ updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
+
+ assert status == ActivityRepresenter.to_map(updated_activity, %{user: activity_user, for: user})
+ end
end