Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into bugfix/repeated-follow-unfollow

This commit is contained in:
dtluna 2017-04-13 15:36:00 +03:00
commit a8e50d602b
11 changed files with 81 additions and 18 deletions

View file

@ -23,8 +23,9 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
}
}
content = "Some content mentioning @shp"
date = DateTime.utc_now() |> DateTime.to_iso8601
content_html = "Some content mentioning <a href='shp'>@shp</shp>"
content = HtmlSanitizeEx.strip_tags(content_html)
date = DateTime.from_naive!(~N[2016-05-24 13:26:08.003], "Etc/UTC") |> DateTime.to_iso8601
activity = %Activity{
id: 1,
@ -39,7 +40,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
"object" => %{
"published" => date,
"type" => "Note",
"content" => content,
"content" => content_html,
"inReplyToStatusId" => 213123,
"statusnetConversationId" => 4711,
"attachment" => [
@ -56,10 +57,10 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
"user" => UserRepresenter.to_map(user, %{for: follower}),
"is_local" => true,
"attentions" => [],
"statusnet_html" => content,
"statusnet_html" => content_html,
"text" => content,
"is_post_verb" => true,
"created_at" => date,
"created_at" => "Tue May 24 13:26:08 +0000 2016",
"in_reply_to_status_id" => 213123,
"statusnet_conversation_id" => 4711,
"attachments" => [

View file

@ -127,7 +127,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
current_user = Repo.get(User, current_user.id)
assert current_user.following == [User.ap_followers(followed)]
assert json_response(conn, 200) == UserRepresenter.to_map(followed)
assert json_response(conn, 200) == UserRepresenter.to_map(followed, %{for: current_user})
end
end
@ -150,7 +150,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
current_user = Repo.get(User, current_user.id)
assert current_user.following == []
assert json_response(conn, 200) == UserRepresenter.to_map(followed)
assert json_response(conn, 200) == UserRepresenter.to_map(followed, %{for: current_user})
end
end

View file

@ -82,15 +82,18 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
test "fetch friends' statuses" do
ActivityBuilder.public_and_non_public
{:ok, activity} = ActivityBuilder.insert(%{"to" => ["someguy/followers"]})
{:ok, direct_activity} = ActivityBuilder.insert(%{"to" => ["some other id"]})
{:ok, user} = UserBuilder.insert(%{ap_id: "some other id", following: ["someguy/followers"]})
statuses = TwitterAPI.fetch_friend_statuses(user)
activity_user = Repo.get_by(User, ap_id: activity.data["actor"])
assert length(statuses) == 1
assert length(statuses) == 2
assert Enum.at(statuses, 0) == ActivityRepresenter.to_map(activity, %{user: activity_user})
assert Enum.at(statuses, 1) == ActivityRepresenter.to_map(direct_activity, %{user: activity_user, mentioned: [user]})
end
test "fetch a single status" do