forked from AkkomaGang/akkoma
twitterapi: fix remaining test failures
This commit is contained in:
parent
6f5f589f73
commit
e8570758f9
2 changed files with 23 additions and 20 deletions
|
@ -141,7 +141,7 @@ def to_map(
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_map(
|
def to_map(
|
||||||
%Activity{data: %{"object" => %{"content" => content} = object}} = activity,
|
%Activity{data: %{"object" => object}} = activity,
|
||||||
%{user: user} = opts
|
%{user: user} = opts
|
||||||
) do
|
) do
|
||||||
object = Object.normalize(object)
|
object = Object.normalize(object)
|
||||||
|
|
|
@ -87,6 +87,26 @@ test "an activity" do
|
||||||
|
|
||||||
{:ok, convo_object} = Object.context_mapping("2hu") |> Repo.insert()
|
{:ok, convo_object} = Object.context_mapping("2hu") |> Repo.insert()
|
||||||
|
|
||||||
|
note_object = %{
|
||||||
|
"id" => "https://example.com/id/1",
|
||||||
|
"published" => date,
|
||||||
|
"type" => "Note",
|
||||||
|
"content" => content_html,
|
||||||
|
"summary" => "2hu",
|
||||||
|
"inReplyToStatusId" => 213_123,
|
||||||
|
"attachment" => [object.data],
|
||||||
|
"external_url" => "some url",
|
||||||
|
"like_count" => 5,
|
||||||
|
"announcement_count" => 3,
|
||||||
|
"context" => "2hu",
|
||||||
|
"tag" => ["content", "mentioning", "nsfw"],
|
||||||
|
"emoji" => %{
|
||||||
|
"2hu" => "corndog.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.create(note_object)
|
||||||
|
|
||||||
to = [
|
to = [
|
||||||
User.ap_followers(user),
|
User.ap_followers(user),
|
||||||
"https://www.w3.org/ns/activitystreams#Public",
|
"https://www.w3.org/ns/activitystreams#Public",
|
||||||
|
@ -100,24 +120,7 @@ test "an activity" do
|
||||||
"id" => "id",
|
"id" => "id",
|
||||||
"to" => to,
|
"to" => to,
|
||||||
"actor" => User.ap_id(user),
|
"actor" => User.ap_id(user),
|
||||||
"object" => %{
|
"object" => note_object["id"],
|
||||||
"published" => date,
|
|
||||||
"type" => "Note",
|
|
||||||
"content" => content_html,
|
|
||||||
"summary" => "2hu",
|
|
||||||
"inReplyToStatusId" => 213_123,
|
|
||||||
"attachment" => [
|
|
||||||
object
|
|
||||||
],
|
|
||||||
"external_url" => "some url",
|
|
||||||
"like_count" => 5,
|
|
||||||
"announcement_count" => 3,
|
|
||||||
"context" => "2hu",
|
|
||||||
"tag" => ["content", "mentioning", "nsfw"],
|
|
||||||
"emoji" => %{
|
|
||||||
"2hu" => "corndog.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"published" => date,
|
"published" => date,
|
||||||
"context" => "2hu"
|
"context" => "2hu"
|
||||||
},
|
},
|
||||||
|
@ -158,7 +161,7 @@ test "an activity" do
|
||||||
"tags" => ["nsfw", "content", "mentioning"],
|
"tags" => ["nsfw", "content", "mentioning"],
|
||||||
"activity_type" => "post",
|
"activity_type" => "post",
|
||||||
"possibly_sensitive" => true,
|
"possibly_sensitive" => true,
|
||||||
"uri" => activity.data["object"]["id"],
|
"uri" => note_object["id"],
|
||||||
"visibility" => "direct",
|
"visibility" => "direct",
|
||||||
"summary" => "2hu"
|
"summary" => "2hu"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue