Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/follow-by-screen-name
This commit is contained in:
commit
3ff917b5dd
11 changed files with 78 additions and 15 deletions
|
|
@ -94,6 +94,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
assert length(activities) == 10
|
||||
assert last == last_expected
|
||||
end
|
||||
|
||||
test "retrieves ids up to max_id" do
|
||||
_first_activities = ActivityBuilder.insert_list(10)
|
||||
activities = ActivityBuilder.insert_list(20)
|
||||
later_activities = ActivityBuilder.insert_list(10)
|
||||
max_id = List.first(later_activities).id
|
||||
last_expected = List.last(activities)
|
||||
|
||||
activities = ActivityPub.fetch_public_activities(%{"max_id" => max_id})
|
||||
last = List.last(activities)
|
||||
|
||||
assert length(activities) == 20
|
||||
assert last == last_expected
|
||||
end
|
||||
end
|
||||
|
||||
describe "uploading files" do
|
||||
|
|
|
|||
|
|
@ -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" => [
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue