Update/fix test
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
c78495900e
commit
739dbfff6f
9 changed files with 48 additions and 71 deletions
|
@ -611,7 +611,9 @@ def handle_incoming(
|
|||
end
|
||||
end
|
||||
|
||||
def handle_incoming(_, _), do: :error
|
||||
def handle_incoming(_, _) do
|
||||
IO.inspect(:error)
|
||||
end
|
||||
|
||||
@spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil
|
||||
def get_obj_helper(id, options \\ []) do
|
||||
|
|
|
@ -702,8 +702,6 @@ def get_reply_to(%{data: %{"object" => _object}} = activity, _) do
|
|||
end
|
||||
end
|
||||
|
||||
def get_quote(_activity, %{show_quote: false}), do: nil
|
||||
|
||||
def get_quote(activity, %{quoted_activities: quoted_activities}) do
|
||||
object = Object.normalize(activity, fetch: false)
|
||||
|
||||
|
|
53
test/fixtures/fep-e232.json
vendored
53
test/fixtures/fep-e232.json
vendored
|
@ -1,28 +1,31 @@
|
|||
{
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"id": "https://mitra.social/objects/01839574-d41f-01a7-8eef-abfe0badcd6a",
|
||||
"type": "Note",
|
||||
"attributedTo": "https://mitra.social/users/silverpill",
|
||||
"content": "Quote test<p class=\"inline-quote\">RE: <a href=\"https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749\">https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749</a></p>",
|
||||
"published": "2022-10-01T21:30:05.211215Z",
|
||||
"tag": [
|
||||
{
|
||||
"name": "@silverpill@mitra.social",
|
||||
"type": "Mention",
|
||||
"href": "https://mitra.social/users/silverpill"
|
||||
},
|
||||
{
|
||||
"name": "RE: https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749",
|
||||
"type": "Link",
|
||||
"href": "https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749",
|
||||
"mediaType": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
|
||||
}
|
||||
],
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public",
|
||||
"https://mitra.social/users/silverpill"
|
||||
],
|
||||
"cc": [
|
||||
"https://mitra.social/users/silverpill/followers"
|
||||
]
|
||||
"type": "Create",
|
||||
"actor": "https://example.org/users/alice",
|
||||
"object": {
|
||||
"id": "https://example.org/objects/10",
|
||||
"type": "Note",
|
||||
"attributedTo": "https://example.org/users/alice",
|
||||
"content": "<p>test <a href=\"https://example.org/objects/9\">https://example.org/objects/9</a></p>",
|
||||
"published": "2022-10-01T21:30:05.211215Z",
|
||||
"tag": [
|
||||
{
|
||||
"name": "@bob@example.net",
|
||||
"type": "Mention",
|
||||
"href": "https://example.net/users/bob"
|
||||
},
|
||||
{
|
||||
"name": "https://example.org/objects/9",
|
||||
"type": "Link",
|
||||
"href": "https://example.org/objects/9",
|
||||
"mediaType": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
|
||||
}
|
||||
],
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"https://example.org/users/alice/followers"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,11 @@ defmodule Pleroma.MigrationHelper.NotificationBackfillTest do
|
|||
|
||||
import Pleroma.Factory
|
||||
|
||||
setup do
|
||||
Mox.stub_with(Pleroma.UnstubbedConfigMock, Pleroma.Config)
|
||||
:ok
|
||||
end
|
||||
|
||||
describe "fill_in_notification_types" do
|
||||
test "it fills in missing notification types" do
|
||||
user = insert(:user)
|
||||
|
|
|
@ -155,47 +155,6 @@ test "it accepts quote posts" do
|
|||
# It fetched the quoted post
|
||||
assert Object.normalize("https://misskey.io/notes/8vs6wxufd0")
|
||||
end
|
||||
|
||||
test "it accepts FEP-e232 quote posts" do
|
||||
insert(:user, ap_id: "https://mitra.social/users/silverpill")
|
||||
|
||||
object = File.read!("test/fixtures/fep-e232.json") |> Jason.decode!()
|
||||
|
||||
message = %{
|
||||
"@context" => "https://www.w3.org/ns/activitystreams",
|
||||
"type" => "Create",
|
||||
"actor" => "https://mitra.social/users/silverpill",
|
||||
"object" => object
|
||||
}
|
||||
|
||||
assert {:ok, activity} = Transmogrifier.handle_incoming(message)
|
||||
|
||||
# Object was created in the database
|
||||
object = Object.normalize(activity)
|
||||
|
||||
assert object.data["quoteUrl"] ==
|
||||
"https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749"
|
||||
|
||||
# The Link tag was normalized
|
||||
assert object.data["tag"] == [
|
||||
%{
|
||||
"href" => "https://mitra.social/users/silverpill",
|
||||
"name" => "@silverpill@mitra.social",
|
||||
"type" => "Mention"
|
||||
},
|
||||
%{
|
||||
"href" => "https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749",
|
||||
"mediaType" =>
|
||||
"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"",
|
||||
"name" =>
|
||||
"RE: https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749",
|
||||
"type" => "Link"
|
||||
}
|
||||
]
|
||||
|
||||
# It fetched the quoted post
|
||||
assert Object.normalize("https://mitra.social/objects/01830912-1357-d4c5-e4a2-76eab347e749")
|
||||
end
|
||||
end
|
||||
|
||||
describe "prepare outgoing" do
|
||||
|
|
|
@ -29,6 +29,8 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
Mox.stub_with(Pleroma.UnstubbedConfigMock, Pleroma.Config)
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
|
|
|
@ -444,7 +444,8 @@ test "a quote post" do
|
|||
assert status.pleroma.quote_url == Object.normalize(quote_post).data["id"]
|
||||
assert status.pleroma.quote_visible
|
||||
|
||||
# Quotes don't go more than one level deep
|
||||
# Quotes don't go more than one level deep\
|
||||
IO.inspect(status.pleroma.quote.pleroma)
|
||||
refute status.pleroma.quote.pleroma.quote
|
||||
assert status.pleroma.quote.pleroma.quote_id == to_string(post.id)
|
||||
assert status.pleroma.quote.pleroma.quote_url == Object.normalize(post).data["id"]
|
||||
|
@ -718,7 +719,7 @@ test "a Mobilizon event" do
|
|||
name: "Cour du Château des Ducs de Bretagne",
|
||||
postal_code: nil,
|
||||
region: "Pays de la Loire",
|
||||
street: " ",
|
||||
street: nil,
|
||||
url: nil
|
||||
},
|
||||
join_state: nil,
|
||||
|
|
|
@ -11,6 +11,11 @@ defmodule Pleroma.Web.PleromaAPI.NotificationControllerTest do
|
|||
|
||||
import Pleroma.Factory
|
||||
|
||||
setup do
|
||||
Mox.stub_with(Pleroma.UnstubbedConfigMock, Pleroma.Config)
|
||||
:ok
|
||||
end
|
||||
|
||||
describe "POST /api/v1/pleroma/notifications/read" do
|
||||
setup do: oauth_access(["write:notifications"])
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ defmodule Pleroma.Web.Push.ImplTest do
|
|||
%Tesla.Env{status: 100}
|
||||
end)
|
||||
|
||||
Mox.stub_with(Pleroma.UnstubbedConfigMock, Pleroma.Config)
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue