Browse Source

salmon fix

removed some ownership sandbox error
tags/v1.1.4
Alex S 5 years ago
parent
commit
0f59265a50
3 changed files with 30 additions and 2 deletions
  1. +1
    -1
      lib/pleroma/web/salmon/salmon.ex
  2. +5
    -1
      test/object/containment_test.exs
  3. +24
    -0
      test/support/http_request_mock.ex

+ 1
- 1
lib/pleroma/web/salmon/salmon.ex View File

@@ -146,7 +146,7 @@ defmodule Pleroma.Web.Salmon do
do: Instances.set_reachable(url)

Logger.debug(fn -> "Pushed to #{url}, code #{code}" end)
:ok
{:ok, code}
else
e ->
unless params[:unreachable_since], do: Instances.set_reachable(url)


+ 5
- 1
test/object/containment_test.exs View File

@@ -5,6 +5,7 @@ defmodule Pleroma.Object.ContainmentTest do
alias Pleroma.User

import Pleroma.Factory
import ExUnit.CaptureLog

setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
@@ -57,7 +58,10 @@ defmodule Pleroma.Object.ContainmentTest do
follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})
})

{:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
assert capture_log(fn ->
{:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
end) =~
"[error] Could not decode user at fetch https://n1u.moe/users/rye, {:error, :error}"
end
end
end

+ 24
- 0
test/support/http_request_mock.ex View File

@@ -802,6 +802,30 @@ defmodule HttpRequestMock do
}}
end

def post("http://mastodon.example.org/inbox", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
body: ""
}}
end

def post("https://hubzilla.example.org/inbox", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
body: ""
}}
end

def post("http://gs.example.org/index.php/main/salmon/user/1", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
body: ""
}}
end

def post("http://200.site" <> _, _, _, _) do
{:ok,
%Tesla.Env{


Loading…
Cancel
Save