commit
9938fa3293
@ -1,9 +1,7 @@
|
|||||||
CREATE USER <%= dbuser %> WITH ENCRYPTED PASSWORD '<%= dbpass %>' CREATEDB;
|
CREATE USER pleroma WITH ENCRYPTED PASSWORD '<%= dbpass %>';
|
||||||
-- in case someone runs this second time accidentally
|
CREATE DATABASE pleroma_dev OWNER pleroma;
|
||||||
ALTER USER <%= dbuser %> WITH ENCRYPTED PASSWORD '<%= dbpass %>' CREATEDB;
|
\c pleroma_dev;
|
||||||
CREATE DATABASE <%= dbname %>;
|
|
||||||
ALTER DATABASE <%= dbname %> OWNER TO <%= dbuser %>;
|
|
||||||
\c <%= dbname %>;
|
|
||||||
--Extensions made by ecto.migrate that need superuser access
|
--Extensions made by ecto.migrate that need superuser access
|
||||||
CREATE EXTENSION IF NOT EXISTS citext;
|
CREATE EXTENSION IF NOT EXISTS citext;
|
||||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||||
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
defmodule Pleroma.HTTP.Connection do
|
||||||
|
@moduledoc """
|
||||||
|
Connection for http-requests.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@hackney_options [pool: :default]
|
||||||
|
@adapter Application.get_env(:tesla, :adapter)
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Configure a client connection
|
||||||
|
|
||||||
|
# Returns
|
||||||
|
|
||||||
|
Tesla.Env.client
|
||||||
|
"""
|
||||||
|
@spec new(Keyword.t()) :: Tesla.Env.client()
|
||||||
|
def new(opts \\ []) do
|
||||||
|
Tesla.client([], {@adapter, hackney_options(opts)})
|
||||||
|
end
|
||||||
|
|
||||||
|
# fetch Hackney options
|
||||||
|
#
|
||||||
|
defp hackney_options(opts \\ []) do
|
||||||
|
options = Keyword.get(opts, :adapter, [])
|
||||||
|
@hackney_options ++ options
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,126 @@
|
|||||||
|
defmodule Pleroma.HTTP.RequestBuilder do
|
||||||
|
@moduledoc """
|
||||||
|
Helper functions for building Tesla requests
|
||||||
|
"""
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Specify the request method when building a request
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- request (Map) - Collected request options
|
||||||
|
- m (atom) - Request method
|
||||||
|
|
||||||
|
## Returns
|
||||||
|
|
||||||
|
Map
|
||||||
|
"""
|
||||||
|
@spec method(map(), atom) :: map()
|
||||||
|
def method(request, m) do
|
||||||
|
Map.put_new(request, :method, m)
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Specify the request method when building a request
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- request (Map) - Collected request options
|
||||||
|
- u (String) - Request URL
|
||||||
|
|
||||||
|
## Returns
|
||||||
|
|
||||||
|
Map
|
||||||
|
"""
|
||||||
|
@spec url(map(), String.t()) :: map()
|
||||||
|
def url(request, u) do
|
||||||
|
Map.put_new(request, :url, u)
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Add headers to the request
|
||||||
|
"""
|
||||||
|
@spec headers(map(), list(tuple)) :: map()
|
||||||
|
def headers(request, h) do
|
||||||
|
Map.put_new(request, :headers, h)
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Add custom, per-request middleware or adapter options to the request
|
||||||
|
"""
|
||||||
|
@spec opts(map(), Keyword.t()) :: map()
|
||||||
|
def opts(request, options) do
|
||||||
|
Map.put_new(request, :opts, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Add optional parameters to the request
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- request (Map) - Collected request options
|
||||||
|
- definitions (Map) - Map of parameter name to parameter location.
|
||||||
|
- options (KeywordList) - The provided optional parameters
|
||||||
|
|
||||||
|
## Returns
|
||||||
|
|
||||||
|
Map
|
||||||
|
"""
|
||||||
|
@spec add_optional_params(map(), %{optional(atom) => atom}, keyword()) :: map()
|
||||||
|
def add_optional_params(request, _, []), do: request
|
||||||
|
|
||||||
|
def add_optional_params(request, definitions, [{key, value} | tail]) do
|
||||||
|
case definitions do
|
||||||
|
%{^key => location} ->
|
||||||
|
request
|
||||||
|
|> add_param(location, key, value)
|
||||||
|
|> add_optional_params(definitions, tail)
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
add_optional_params(request, definitions, tail)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Add optional parameters to the request
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- request (Map) - Collected request options
|
||||||
|
- location (atom) - Where to put the parameter
|
||||||
|
- key (atom) - The name of the parameter
|
||||||
|
- value (any) - The value of the parameter
|
||||||
|
|
||||||
|
## Returns
|
||||||
|
|
||||||
|
Map
|
||||||
|
"""
|
||||||
|
@spec add_param(map(), atom, atom, any()) :: map()
|
||||||
|
def add_param(request, :body, :body, value), do: Map.put(request, :body, value)
|
||||||
|
|
||||||
|
def add_param(request, :body, key, value) do
|
||||||
|
request
|
||||||
|
|> Map.put_new_lazy(:body, &Tesla.Multipart.new/0)
|
||||||
|
|> Map.update!(
|
||||||
|
:body,
|
||||||
|
&Tesla.Multipart.add_field(&1, key, Poison.encode!(value),
|
||||||
|
headers: [{:"Content-Type", "application/json"}]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_param(request, :file, name, path) do
|
||||||
|
request
|
||||||
|
|> Map.put_new_lazy(:body, &Tesla.Multipart.new/0)
|
||||||
|
|> Map.update!(:body, &Tesla.Multipart.add_file(&1, path, name: name))
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_param(request, :form, name, value) do
|
||||||
|
request
|
||||||
|
|> Map.update(:body, %{name => value}, &Map.put(&1, name, value))
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_param(request, location, key, value) do
|
||||||
|
Map.update(request, location, [{key, value}], &(&1 ++ [{key, value}]))
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,165 @@
|
|||||||
|
defmodule Pleroma.User.Info do
|
||||||
|
use Ecto.Schema
|
||||||
|
import Ecto.Changeset
|
||||||
|
|
||||||
|
embedded_schema do
|
||||||
|
field(:banner, :map, default: %{})
|
||||||
|
field(:background, :map, default: %{})
|
||||||
|
field(:source_data, :map, default: %{})
|
||||||
|
field(:note_count, :integer, default: 0)
|
||||||
|
field(:follower_count, :integer, default: 0)
|
||||||
|
field(:locked, :boolean, default: false)
|
||||||
|
field(:default_scope, :string, default: "public")
|
||||||
|
field(:blocks, {:array, :string}, default: [])
|
||||||
|
field(:domain_blocks, {:array, :string}, default: [])
|
||||||
|
field(:deactivated, :boolean, default: false)
|
||||||
|
field(:no_rich_text, :boolean, default: false)
|
||||||
|
field(:ap_enabled, :boolean, default: false)
|
||||||
|
field(:is_moderator, :boolean, default: false)
|
||||||
|
field(:is_admin, :boolean, default: false)
|
||||||
|
field(:keys, :string, default: nil)
|
||||||
|
field(:settings, :map, default: nil)
|
||||||
|
field(:magic_key, :string, default: nil)
|
||||||
|
field(:uri, :string, default: nil)
|
||||||
|
field(:topic, :string, default: nil)
|
||||||
|
field(:hub, :string, default: nil)
|
||||||
|
field(:salmon, :string, default: nil)
|
||||||
|
|
||||||
|
# Found in the wild
|
||||||
|
# ap_id -> Where is this used?
|
||||||
|
# bio -> Where is this used?
|
||||||
|
# avatar -> Where is this used?
|
||||||
|
# fqn -> Where is this used?
|
||||||
|
# host -> Where is this used?
|
||||||
|
# subject _> Where is this used?
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_activation_status(info, deactivated) do
|
||||||
|
params = %{deactivated: deactivated}
|
||||||
|
|
||||||
|
info
|
||||||
|
|> cast(params, [:deactivated])
|
||||||
|
|> validate_required([:deactivated])
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_to_note_count(info, number) do
|
||||||
|
set_note_count(info, info.note_count + number)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_note_count(info, number) do
|
||||||
|
params = %{note_count: Enum.max([0, number])}
|
||||||
|
|
||||||
|
info
|
||||||
|
|> cast(params, [:note_count])
|
||||||
|
|> validate_required([:note_count])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_follower_count(info, number) do
|
||||||
|
params = %{follower_count: Enum.max([0, number])}
|
||||||
|
|
||||||
|
info
|
||||||
|
|> cast(params, [:follower_count])
|
||||||
|
|> validate_required([:follower_count])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_blocks(info, blocks) do
|
||||||
|
params = %{blocks: blocks}
|
||||||
|
|
||||||
|
info
|
||||||
|
|> cast(params, [:blocks])
|
||||||
|
|> validate_required([:blocks])
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_to_block(info, blocked) do
|
||||||
|
set_blocks(info, Enum.uniq([blocked | info.blocks]))
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_from_block(info, blocked) do
|
||||||
|
set_blocks(info, List.delete(info.blocks, blocked))
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_domain_blocks(info, domain_blocks) do
|
||||||
|
params = %{domain_blocks: domain_blocks}
|
||||||
|
|
||||||
|
info
|
||||||
|
|> cast(params, [:domain_blocks])
|
||||||
|
|> validate_required([:domain_blocks])
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_to_domain_block(info, domain_blocked) do
|
||||||
|
set_domain_blocks(info, Enum.uniq([domain_blocked | info.domain_blocks]))
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_from_domain_block(info, domain_blocked) do
|
||||||
|
set_domain_blocks(info, List.delete(info.domain_blocks, domain_blocked))
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_keys(info, keys) do
|
||||||
|
params = %{keys: keys}
|
||||||
|
|
||||||
|
info
|
||||||
|
|> cast(params, [:keys])
|
||||||
|
|> validate_required([:keys])
|
||||||
|
end
|
||||||
|
|
||||||
|
def remote_user_creation(info, params) do
|
||||||
|
info
|
||||||
|
|> cast(params, [
|
||||||
|
:ap_enabled,
|
||||||
|
:source_data,
|
||||||
|
:banner,
|
||||||
|
:locked,
|
||||||
|
:magic_key,
|
||||||
|
:uri,
|
||||||
|
:hub,
|
||||||
|
:topic,
|
||||||
|
:salmon
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_upgrade(info, params) do
|
||||||
|
info
|
||||||
|
|> cast(params, [
|
||||||
|
:ap_enabled,
|
||||||
|
:source_data,
|
||||||
|
:banner,
|
||||||
|
:locked,
|
||||||
|
:magic_key
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
def profile_update(info, params) do
|
||||||
|
info
|
||||||
|
|> cast(params, [
|
||||||
|
:locked,
|
||||||
|
:no_rich_text,
|
||||||
|
:default_scope,
|
||||||
|
:banner,
|
||||||
|
:background
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
def mastodon_profile_update(info, params) do
|
||||||
|
info
|
||||||
|
|> cast(params, [
|
||||||
|
:locked,
|
||||||
|
:banner
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_source_data(info, source_data) do
|
||||||
|
params = %{source_data: source_data}
|
||||||
|
|
||||||
|
info
|
||||||
|
|> cast(params, [:source_data])
|
||||||
|
|> validate_required([:source_data])
|
||||||
|
end
|
||||||
|
|
||||||
|
def admin_api_update(info, params) do
|
||||||
|
info
|
||||||
|
|> cast(params, [
|
||||||
|
:is_moderator,
|
||||||
|
:is_admin
|
||||||
|
])
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
defmodule Pleroma.Repo.Migrations.AddUUIDExtension do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
execute("create extension if not exists \"uuid-ossp\"")
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
defmodule Pleroma.Repo.Migrations.AddUUIDsToUserInfo do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
execute("update users set info = jsonb_set(info, '{\"id\"}', to_jsonb(uuid_generate_v4()))")
|
||||||
|
end
|
||||||
|
end
|
@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Pleroma</title><link rel=icon type=image/png href=/favicon.png><link rel=stylesheet href=/static/font/css/fontello.css><link rel=stylesheet href=/static/font/css/animation.css><link href=/static/css/app.0808aeafc6252b3050ea95b17dcaff1a.css rel=stylesheet></head><body style="display: none"><div id=app></div><script type=text/javascript src=/static/js/manifest.34667c2817916147413f.js></script><script type=text/javascript src=/static/js/vendor.32c621c7157f34c20923.js></script><script type=text/javascript src=/static/js/app.065638d22ade92dea420.js></script></body></html>
|
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Pleroma</title><link rel=icon type=image/png href=/favicon.png><link rel=stylesheet href=/static/font/css/fontello.css><link rel=stylesheet href=/static/font/css/animation.css><link href=/static/css/app.0808aeafc6252b3050ea95b17dcaff1a.css rel=stylesheet></head><body style="display: none"><div id=app></div><script type=text/javascript src=/static/js/manifest.18df0da570d88ba76ec5.js></script><script type=text/javascript src=/static/js/vendor.0e895ca116d5ba12f2b6.js></script><script type=text/javascript src=/static/js/app.3f7c9aaedc6b87fa9653.js></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
|||||||
|
!function(e){function t(a){if(r[a])return r[a].exports;var n=r[a]={exports:{},id:a,loaded:!1};return e[a].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var a=window.webpackJsonp;window.webpackJsonp=function(c,o){for(var p,l,s=0,i=[];s<c.length;s++)l=c[s],n[l]&&i.push.apply(i,n[l]),n[l]=0;for(p in o)Object.prototype.hasOwnProperty.call(o,p)&&(e[p]=o[p]);for(a&&a(c,o);i.length;)i.shift().call(null,t);if(o[0])return r[0]=0,t(0)};var r={},n={0:0};t.e=function(e,a){if(0===n[e])return a.call(null,t);if(void 0!==n[e])n[e].push(a);else{n[e]=[a];var r=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.src=t.p+"static/js/"+e+"."+{1:"0e895ca116d5ba12f2b6",2:"3f7c9aaedc6b87fa9653"}[e]+".js",r.appendChild(c)}},t.m=e,t.c=r,t.p="/"}([]);
|
||||||
|
//# sourceMappingURL=manifest.18df0da570d88ba76ec5.js.map
|
File diff suppressed because one or more lines are too long
@ -1,2 +0,0 @@
|
|||||||
!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r=window.webpackJsonp;window.webpackJsonp=function(c,o){for(var p,l,s=0,i=[];s<c.length;s++)l=c[s],a[l]&&i.push.apply(i,a[l]),a[l]=0;for(p in o)Object.prototype.hasOwnProperty.call(o,p)&&(e[p]=o[p]);for(r&&r(c,o);i.length;)i.shift().call(null,t);if(o[0])return n[0]=0,t(0)};var n={},a={0:0};t.e=function(e,r){if(0===a[e])return r.call(null,t);if(void 0!==a[e])a[e].push(r);else{a[e]=[r];var n=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.src=t.p+"static/js/"+e+"."+{1:"32c621c7157f34c20923",2:"065638d22ade92dea420"}[e]+".js",n.appendChild(c)}},t.m=e,t.c=n,t.p="/"}([]);
|
|
||||||
//# sourceMappingURL=manifest.34667c2817916147413f.js.map
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><hm:Host xmlns:hm="http://host-meta.net/xrd/1.0">framatube.org</hm:Host><Link rel="lrdd" template="http://framatube.org/main/xrd?uri={uri}"><Title>Resource Descriptor</Title></Link></XRD>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?><XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
|
||||||
|
xmlns:hm='http://host-meta.net/xrd/1.0'>
|
||||||
|
|
||||||
|
<hm:Host>gerzilla.de</hm:Host>
|
||||||
|
|
||||||
|
<Link rel='lrdd' type="application/xrd+xml" template='https://gerzilla.de/xrd/?uri={uri}' />
|
||||||
|
<Link rel="http://oexchange.org/spec/0.8/rel/resident-target" type="application/xrd+xml"
|
||||||
|
href="https://gerzilla.de/oexchange/xrd" />
|
||||||
|
|
||||||
|
</XRD>
|
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><hm:Host xmlns:hm="http://host-meta.net/xrd/1.0">gnusocial.de</hm:Host><Link rel="lrdd" template="http://gnusocial.de/main/xrd?uri={uri}"><Title>Resource Descriptor</Title></Link></XRD>
|
@ -0,0 +1,55 @@
|
|||||||
|
defmodule Pleroma.HTTPTest do
|
||||||
|
use Pleroma.DataCase
|
||||||
|
import Tesla.Mock
|
||||||
|
|
||||||
|
setup do
|
||||||
|
mock(fn
|
||||||
|
%{
|
||||||
|
method: :get,
|
||||||
|
url: "http://example.com/hello",
|
||||||
|
headers: [{"content-type", "application/json"}]
|
||||||
|
} ->
|
||||||
|
json(%{"my" => "data"})
|
||||||
|
|
||||||
|
%{method: :get, url: "http://example.com/hello"} ->
|
||||||
|
%Tesla.Env{status: 200, body: "hello"}
|
||||||
|
|
||||||
|
%{method: :post, url: "http://example.com/world"} ->
|
||||||
|
%Tesla.Env{status: 200, body: "world"}
|
||||||
|
end)
|
||||||
|
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "get/1" do
|
||||||
|
test "returns successfully result" do
|
||||||
|
assert Pleroma.HTTP.get("http://example.com/hello") == {
|
||||||
|
:ok,
|
||||||
|
%Tesla.Env{status: 200, body: "hello"}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "get/2 (with headers)" do
|
||||||
|
test "returns successfully result for json content-type" do
|
||||||
|
assert Pleroma.HTTP.get("http://example.com/hello", [{"content-type", "application/json"}]) ==
|
||||||
|
{
|
||||||
|
:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: "{\"my\":\"data\"}",
|
||||||
|
headers: [{"content-type", "application/json"}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "post/2" do
|
||||||
|
test "returns successfully result" do
|
||||||
|
assert Pleroma.HTTP.post("http://example.com/world", "") == {
|
||||||
|
:ok,
|
||||||
|
%Tesla.Env{status: 200, body: "world"}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,675 @@
|
|||||||
|
defmodule HttpRequestMock do
|
||||||
|
require Logger
|
||||||
|
|
||||||
|
def request(
|
||||||
|
%Tesla.Env{
|
||||||
|
url: url,
|
||||||
|
method: method,
|
||||||
|
headers: headers,
|
||||||
|
query: query,
|
||||||
|
body: body
|
||||||
|
} = _env
|
||||||
|
) do
|
||||||
|
with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do
|
||||||
|
res
|
||||||
|
else
|
||||||
|
{_, r} = error ->
|
||||||
|
# Logger.warn(r)
|
||||||
|
error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET Requests
|
||||||
|
#
|
||||||
|
def get(url, query \\ [], body \\ [], headers \\ [])
|
||||||
|
|
||||||
|
def get("https://osada.macgirvin.com/channel/mike", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!("test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/mike@osada.macgirvin.com.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://pawoo.net/users/pekorino.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://pawoo.net/.well-known/webfinger?resource=acct:https://pawoo.net/users/pekorino",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=acct:https://social.stopwatchingus-heidelberg.de/user/18330",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://mamot.fr/users/Skruyb.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://mamot.fr/.well-known/webfinger?resource=acct:https://mamot.fr/users/Skruyb",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://social.heldscal.la/.well-known/webfinger?resource=nonexistant@social.heldscal.la",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://squeet.me/xrd/?uri=lain@squeet.me", _, _,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://mst3k.interlinked.me/users/luciferMysticus", _, _,
|
||||||
|
Accept: "application/activity+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://prismo.news/@mxb", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___prismo.news__mxb.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://hubzilla.example.org/channel/kaniini", _, _,
|
||||||
|
Accept: "application/activity+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://niu.moe/users/rye", _, _, Accept: "application/activity+json") do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/rye.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://puckipedia.com/", _, _, Accept: "application/activity+json") do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://peertube.moe/accounts/7even", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/7even.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://mastodon.example.org/users/admin", _, _, Accept: "application/activity+json") do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://mastodon.example.org/@admin/99541947525187367", _, _,
|
||||||
|
Accept: "application/activity+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/mastodon-note-object.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://shitposter.club/notice/7369654", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/7369654.html")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://mstdn.io/users/mayuutann", _, _, Accept: "application/activity+json") do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://mstdn.io/users/mayuutann/statuses/99568293732299394", _, _,
|
||||||
|
Accept: "application/activity+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://pleroma.soykaf.com/users/lain/feed.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(url, _, _, Accept: "application/xrd+xml,application/jrd+json")
|
||||||
|
when url in [
|
||||||
|
"https://pleroma.soykaf.com/.well-known/webfinger?resource=acct:https://pleroma.soykaf.com/users/lain",
|
||||||
|
"https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain"
|
||||||
|
] do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://shitposter.club/notice/2827873", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://shitposter.club/api/statuses/show/2827873.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://testing.pleroma.lol/objects/b319022a-4946-44c5-9de9-34801f95507b", _, _, _) do
|
||||||
|
{:ok, %Tesla.Env{status: 200}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://shitposter.club/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://shitposter.club/api/statuses/show/7369654.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://shitposter.club/notice/4027863", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/7369654.html")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://social.sakamoto.gq/users/eal/feed.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://social.sakamoto.gq/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056", _, _,
|
||||||
|
Accept: "application/atom+xml"
|
||||||
|
) do
|
||||||
|
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://mastodon.social/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://gs.example.org/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://squeet.me/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{status: 200, body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://squeet.me/xrd?uri=lain@squeet.me", _, _,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://framatube.org/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/framatube.org_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://framatube.org/main/xrd?uri=framasoft@framatube.org", _, _,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
headers: [{"content-type", "application/json"}],
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://gnusocial.de/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/gnusocial.de_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://gnusocial.de/main/xrd?uri=winterdienst@gnusocial.de", _, _,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://status.alpicola.com/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://macgirvin.com/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://gerzilla.de/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/gerzilla.de_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://gerzilla.de/xrd/?uri=kaniini@gerzilla.de", _, _,
|
||||||
|
Accept: "application/xrd+xml,application/jrd+json"
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
headers: [{"content-type", "application/json"}],
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body:
|
||||||
|
File.read!(
|
||||||
|
"test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(
|
||||||
|
"https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
|
||||||
|
_,
|
||||||
|
_,
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("http://social.heldscal.la/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://social.heldscal.la/.well-known/host-meta", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://mastodon.social/users/lambadalambda.atom", _, _, _) do
|
||||||
|
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/lambadalambda.atom")}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get("https://social.heldscal.la/user/23211", _, _, Accept: "application/activity+json") do
|
||||||
|
{:ok, Tesla.Mock.json(%{"id" => "https://social.heldscal.la/user/23211"}, status: 200)}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(url, query, body, headers) do
|
||||||
|
{:error,
|
||||||
|
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
||||||
|
inspect(headers)
|
||||||
|
}"}
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST Requests
|
||||||
|
#
|
||||||
|
|
||||||
|
def post(url, query \\ [], body \\ [], headers \\ [])
|
||||||
|
|
||||||
|
def post("http://example.org/needs_refresh", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: ""
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def post(url, _query, _body, _headers) do
|
||||||
|
{:error, "Not implemented the mock response for post #{inspect(url)}"}
|
||||||
|
end
|
||||||
|
end
|
@ -1,883 +0,0 @@
|
|||||||
defmodule HTTPoisonMock do
|
|
||||||
alias HTTPoison.Response
|
|
||||||
|
|
||||||
def process_request_options(options), do: options
|
|
||||||
|
|
||||||
def get(url, body \\ [], headers \\ [])
|
|
||||||
|
|
||||||
def get("https://prismo.news/@mxb", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___prismo.news__mxb.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://osada.macgirvin.com/channel/mike", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!("test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
|
|
||||||
_,
|
|
||||||
_
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/mike@osada.macgirvin.com.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://info.pleroma.site/activity.json", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://info.pleroma.site/activity2.json", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://info.pleroma.site/activity3.json", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity3.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://info.pleroma.site/activity4.json", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity4.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://info.pleroma.site/actor.json", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.heldscal.la/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "nonexistant@social.heldscal.la"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 500,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.heldscal.la/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "shp@social.heldscal.la"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.heldscal.la/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://social.heldscal.la/user/23211"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.heldscal.la/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://social.heldscal.la/user/29191"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://mastodon.social/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://mastodon.social/users/lambadalambda"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://shitposter.club/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://shitposter.club/user/1"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"http://gs.example.org/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "http://gs.example.org:4040/index.php/user/1"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://pleroma.soykaf.com/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://pleroma.soykaf.com/users/lain"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
|
|
||||||
_body,
|
|
||||||
_headers
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://shitposter.club/notice/2827873", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def post(
|
|
||||||
"https://social.heldscal.la/main/push/hub",
|
|
||||||
{:form, _data},
|
|
||||||
"Content-type": "application/x-www-form-urlencoded"
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 202
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!(
|
|
||||||
"test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://pawoo.net/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://pawoo.net/users/pekorino"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://pawoo.net/users/pekorino.atom", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://mamot.fr/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://mamot.fr/users/Skruyb"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.sakamoto.gq/.well-known/webfinger",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
params: [resource: "https://social.sakamoto.gq/users/eal"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://squeet.me/xrd/?uri=lain@squeet.me",
|
|
||||||
[Accept: "application/xrd+xml,application/jrd+json"],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://mamot.fr/users/Skruyb.atom", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
|
|
||||||
[Accept: "application/atom+xml"],
|
|
||||||
_
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
|
|
||||||
[],
|
|
||||||
follow_redirect: true
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body:
|
|
||||||
File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://hubzilla.example.org/channel/kaniini",
|
|
||||||
[Accept: "application/activity+json"],
|
|
||||||
_
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/rye.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://n1u.moe/users/rye", [Accept: "application/activity+json"], _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/rye.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://mst3k.interlinked.me/users/luciferMysticus",
|
|
||||||
[Accept: "application/activity+json"],
|
|
||||||
_
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"http://mastodon.example.org/@admin/99541947525187367",
|
|
||||||
[Accept: "application/activity+json"],
|
|
||||||
_
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/mastodon-note-object.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(
|
|
||||||
"https://mstdn.io/users/mayuutann/statuses/99568293732299394",
|
|
||||||
[Accept: "application/activity+json"],
|
|
||||||
_
|
|
||||||
) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://shitposter.club/notice/7369654", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/7369654.html")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get("https://peertube.moe/accounts/7even", _, _) do
|
|
||||||
{:ok,
|
|
||||||
%Response{
|
|
||||||
status_code: 200,
|
|
||||||
body: File.read!("test/fixtures/httpoison_mock/7even.json")
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(url, body, headers) do
|
|
||||||
{:error,
|
|
||||||
"Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
|
|
||||||
inspect(headers)
|
|
||||||
}"}
|
|
||||||
end
|
|
||||||
|
|
||||||
def post(url, _body, _headers) do
|
|
||||||
{:error, "Not implemented the mock response for post #{inspect(url)}"}
|
|
||||||
end
|
|
||||||
|
|
||||||
def post(url, _body, _headers, _options) do
|
|
||||||
{:error, "Not implemented the mock response for post #{inspect(url)}"}
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in new issue