tests: fix a lot of the remaining test failures
This commit is contained in:
parent
4ca4c83871
commit
f7e15d3257
5 changed files with 31 additions and 30 deletions
|
|
@ -33,13 +33,14 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
}
|
||||
|
||||
{:ok, activity = %Activity{}} = TwitterAPI.create_status(user, input)
|
||||
object = Object.normalize(activity.data["object"])
|
||||
|
||||
expected_text =
|
||||
"Hello again, <span><a class='mention' href='shp'>@<span>shp</span></a></span>.<script></script><br>This is on another :moominmamma: line. <a href='http://localhost:4001/tag/2hu' rel='tag'>#2hu</a> <a href='http://localhost:4001/tag/epic' rel='tag'>#epic</a> <a href='http://localhost:4001/tag/phantasmagoric' rel='tag'>#phantasmagoric</a><br><a href=\"http://example.org/image.jpg\" class='attachment'>image.jpg</a>"
|
||||
|
||||
assert get_in(activity.data, ["object", "content"]) == expected_text
|
||||
assert get_in(activity.data, ["object", "type"]) == "Note"
|
||||
assert get_in(activity.data, ["object", "actor"]) == user.ap_id
|
||||
assert get_in(object.data, ["content"]) == expected_text
|
||||
assert get_in(object.data, ["type"]) == "Note"
|
||||
assert get_in(object.data, ["actor"]) == user.ap_id
|
||||
assert get_in(activity.data, ["actor"]) == user.ap_id
|
||||
assert Enum.member?(get_in(activity.data, ["cc"]), User.ap_followers(user))
|
||||
|
||||
|
|
@ -52,18 +53,18 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
assert activity.local == true
|
||||
|
||||
assert %{"moominmamma" => "http://localhost:4001/finmoji/128px/moominmamma-128.png"} =
|
||||
activity.data["object"]["emoji"]
|
||||
object.data["emoji"]
|
||||
|
||||
# hashtags
|
||||
assert activity.data["object"]["tag"] == ["2hu", "epic", "phantasmagoric"]
|
||||
assert object.data["tag"] == ["2hu", "epic", "phantasmagoric"]
|
||||
|
||||
# Add a context
|
||||
assert is_binary(get_in(activity.data, ["context"]))
|
||||
assert is_binary(get_in(activity.data, ["object", "context"]))
|
||||
assert is_binary(get_in(object.data, ["context"]))
|
||||
|
||||
assert is_list(activity.data["object"]["attachment"])
|
||||
assert is_list(object.data["attachment"])
|
||||
|
||||
assert activity.data["object"] == Object.get_by_ap_id(activity.data["object"]["id"]).data
|
||||
assert activity.data["object"] == object.data["id"]
|
||||
|
||||
user = User.get_by_ap_id(user.ap_id)
|
||||
|
||||
|
|
@ -78,6 +79,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
}
|
||||
|
||||
{:ok, activity = %Activity{}} = TwitterAPI.create_status(user, input)
|
||||
object = Object.normalize(activity.data["object"])
|
||||
|
||||
input = %{
|
||||
"status" => "Here's your (you).",
|
||||
|
|
@ -85,14 +87,14 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
}
|
||||
|
||||
{:ok, reply = %Activity{}} = TwitterAPI.create_status(user, input)
|
||||
reply_object = Object.normalize(reply.data["object"])
|
||||
|
||||
assert get_in(reply.data, ["context"]) == get_in(activity.data, ["context"])
|
||||
|
||||
assert get_in(reply.data, ["object", "context"]) ==
|
||||
get_in(activity.data, ["object", "context"])
|
||||
assert get_in(reply_object.data, ["context"]) == get_in(object.data, ["context"])
|
||||
|
||||
assert get_in(reply.data, ["object", "inReplyTo"]) == get_in(activity.data, ["object", "id"])
|
||||
assert get_in(reply.data, ["object", "inReplyToStatusId"]) == activity.id
|
||||
assert get_in(reply_object.data, ["inReplyTo"]) == get_in(activity.data, ["object"])
|
||||
assert get_in(reply_object.data, ["inReplyToStatusId"]) == activity.id
|
||||
end
|
||||
|
||||
test "Follow another user using user_id" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue