[#534] Made federation push sender be determined basing on content instead of referer header. Updated tests.
This commit is contained in:
parent
d3f9e6f6fe
commit
92753b0cd9
15 changed files with 68 additions and 80 deletions
|
|
@ -2,9 +2,16 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
|
|||
use Pleroma.DataCase
|
||||
|
||||
import Pleroma.Factory
|
||||
import Tesla.Mock
|
||||
|
||||
alias Pleroma.{Repo, Activity, Object}
|
||||
alias Pleroma.Web.OStatus
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
end
|
||||
|
||||
describe "deletions" do
|
||||
test "it removes the mentioned activity" do
|
||||
note = insert(:note_activity)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
import Pleroma.Factory
|
||||
alias Pleroma.{User, Repo, Object, Instances}
|
||||
alias Pleroma.{User, Repo, Object}
|
||||
alias Pleroma.Web.CommonAPI
|
||||
alias Pleroma.Web.OStatus.ActivityRepresenter
|
||||
|
||||
|
|
@ -59,24 +59,6 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
|
|||
|
||||
assert response(conn, 200)
|
||||
end
|
||||
|
||||
test "it clears `unreachable` federation status of the sender", %{conn: conn} do
|
||||
sender_url = "https://pleroma.soykaf.com"
|
||||
Instances.set_consistently_unreachable(sender_url)
|
||||
refute Instances.reachable?(sender_url)
|
||||
|
||||
user = insert(:user)
|
||||
salmon = File.read!("test/fixtures/salmon.xml")
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/atom+xml")
|
||||
|> put_req_header("referer", sender_url)
|
||||
|> post("/users/#{user.nickname}/salmon", salmon)
|
||||
|
||||
assert response(conn, 200)
|
||||
assert Instances.reachable?(sender_url)
|
||||
end
|
||||
end
|
||||
|
||||
test "gets a feed", %{conn: conn} do
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ defmodule Pleroma.Web.OStatusTest do
|
|||
use Pleroma.DataCase
|
||||
alias Pleroma.Web.OStatus
|
||||
alias Pleroma.Web.XML
|
||||
alias Pleroma.{Object, Repo, User, Activity}
|
||||
alias Pleroma.{Object, Repo, User, Activity, Instances}
|
||||
import Pleroma.Factory
|
||||
import ExUnit.CaptureLog
|
||||
|
||||
|
|
@ -311,6 +311,22 @@ defmodule Pleroma.Web.OStatusTest do
|
|||
refute User.following?(follower, followed)
|
||||
end
|
||||
|
||||
test "it clears `unreachable` federation status of the sender" do
|
||||
incoming_reaction_xml = File.read!("test/fixtures/share-gs.xml")
|
||||
doc = XML.parse_document(incoming_reaction_xml)
|
||||
actor_uri = XML.string_from_xpath("//author/uri[1]", doc)
|
||||
reacted_to_author_uri = XML.string_from_xpath("//author/uri[2]", doc)
|
||||
|
||||
Instances.set_consistently_unreachable(actor_uri)
|
||||
Instances.set_consistently_unreachable(reacted_to_author_uri)
|
||||
refute Instances.reachable?(actor_uri)
|
||||
refute Instances.reachable?(reacted_to_author_uri)
|
||||
|
||||
{:ok, _} = OStatus.handle_incoming(incoming_reaction_xml)
|
||||
assert Instances.reachable?(actor_uri)
|
||||
refute Instances.reachable?(reacted_to_author_uri)
|
||||
end
|
||||
|
||||
describe "new remote user creation" do
|
||||
test "returns local users" do
|
||||
local_user = insert(:user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue