[#878] Refactored assumptions on embedded object presence in tests. Adjusted note factory to not embed object into activity.
This commit is contained in:
parent
3589b30ddc
commit
daff85a985
17 changed files with 164 additions and 138 deletions
|
|
@ -892,7 +892,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
|||
|
||||
test "with credentials", %{conn: conn, user: current_user} do
|
||||
note_activity = insert(:note_activity)
|
||||
object = Object.get_by_ap_id(note_activity.data["object"]["id"])
|
||||
object = Object.normalize(note_activity)
|
||||
ActivityPub.like(current_user, object)
|
||||
|
||||
conn =
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
}
|
||||
|
||||
{:ok, activity = %Activity{}} = TwitterAPI.create_status(user, input)
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
|
||||
expected_text =
|
||||
"Hello again, <span class='h-card'><a data-user='#{mentioned_user.id}' class='u-url mention' href='shp'>@<span>shp</span></a></span>.<script></script><br>This is on another :firefox: line. <a class='hashtag' data-tag='2hu' href='http://localhost:4001/tag/2hu' rel='tag'>#2hu</a> <a class='hashtag' data-tag='epic' href='http://localhost:4001/tag/epic' rel='tag'>#epic</a> <a class='hashtag' data-tag='phantasmagoric' href='http://localhost:4001/tag/phantasmagoric' rel='tag'>#phantasmagoric</a><br><a href=\"http://example.org/image.jpg\" class='attachment'>image.jpg</a>"
|
||||
|
|
@ -91,7 +91,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
}
|
||||
|
||||
{:ok, activity = %Activity{}} = TwitterAPI.create_status(user, input)
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
|
||||
input = %{
|
||||
"status" => "Here's your (you).",
|
||||
|
|
@ -99,7 +99,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
}
|
||||
|
||||
{:ok, reply = %Activity{}} = TwitterAPI.create_status(user, input)
|
||||
reply_object = Object.normalize(reply.data["object"])
|
||||
reply_object = Object.normalize(reply)
|
||||
|
||||
assert get_in(reply.data, ["context"]) == get_in(activity.data, ["context"])
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
|
||||
assert ActivityView.render("activity.json", %{activity: updated_activity})["fave_num"] == 1
|
||||
|
||||
object = Object.normalize(note_activity.data["object"])
|
||||
object = Object.normalize(note_activity)
|
||||
|
||||
assert object.data["like_count"] == 1
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
|
||||
{:ok, _status} = TwitterAPI.fav(other_user, note_activity.id)
|
||||
|
||||
object = Object.normalize(note_activity.data["object"])
|
||||
object = Object.normalize(note_activity)
|
||||
|
||||
assert object.data["like_count"] == 2
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
test "it unfavorites a status, returns the updated activity" do
|
||||
user = insert(:user)
|
||||
note_activity = insert(:note_activity)
|
||||
object = Object.get_by_ap_id(note_activity.data["object"]["id"])
|
||||
object = Object.normalize(note_activity)
|
||||
|
||||
{:ok, _like_activity, _object} = ActivityPub.like(user, object)
|
||||
updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
|
|||
other_user = insert(:user, %{nickname: "shp"})
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!", "visibility" => "direct"})
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
|
||||
result = ActivityView.render("activity.json", activity: activity)
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
|
|||
user = insert(:user)
|
||||
other_user = insert(:user, %{nickname: "shp"})
|
||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!"})
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
|
||||
convo_id = Utils.context_to_conversation_id(object.data["context"])
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
|
|||
"is_post_verb" => false,
|
||||
"statusnet_html" => "deleted notice {{tag",
|
||||
"text" => "deleted notice {{tag",
|
||||
"uri" => delete.data["object"],
|
||||
"uri" => Object.normalize(delete).data["id"],
|
||||
"user" => UserView.render("show.json", user: user)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue