diff options
author | Sachin Joshi <satchin.joshi@gmail.com> | 2019-06-23 03:25:50 +0000 |
---|---|---|
committer | Sachin Joshi <satchin.joshi@gmail.com> | 2019-06-23 03:25:50 +0000 |
commit | a0c65bbd6c708b555f457bf24ec07d2d41c3fe4a (patch) | |
tree | deb176014e3c1dcb87fba2fe1108e276c2100148 /test/support | |
parent | 1452a96ad6cfd7d250e3f7c10805994cc92016a7 (diff) | |
parent | 72f365df07e2eba75d3339629b01e5a8913513e6 (diff) | |
download | pleroma-a0c65bbd6c708b555f457bf24ec07d2d41c3fe4a.tar.gz |
Merge branch 'develop' into 'remove-avatar-header'
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/factory.ex | 13 | ||||
-rw-r--r-- | test/support/http_request_mock.ex | 61 | ||||
-rw-r--r-- | test/support/ostatus_mock.ex | 11 | ||||
-rw-r--r-- | test/support/websub_mock.ex | 9 |
4 files changed, 74 insertions, 20 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index be6247ca4..5be34660e 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -310,4 +310,17 @@ defmodule Pleroma.Factory do } } end + + def config_factory do + %Pleroma.Web.AdminAPI.Config{ + key: sequence(:key, &"some_key_#{&1}"), + value: + sequence( + :value, + fn key -> + :erlang.term_to_binary(%{another_key: "#{key}somevalue", another: "#{key}somevalue"}) + end + ) + } + end end diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 5b355bfe6..f7f55a11a 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -52,6 +52,14 @@ defmodule HttpRequestMock do }} end + def get("https://mastodon.sdf.org/users/rinpatch", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/httpoison_mock/rinpatch.json") + }} + end + def get( "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/emelie", _, @@ -235,6 +243,14 @@ defmodule HttpRequestMock do }} end + def get("https://n1u.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{ @@ -294,6 +310,10 @@ defmodule HttpRequestMock do }} end + def get("http://mastodon.example.org/users/gargron", _, _, Accept: "application/activity+json") do + {:error, :nxdomain} + end + def get( "http://mastodon.example.org/@admin/99541947525187367", _, @@ -538,6 +558,15 @@ defmodule HttpRequestMock do }} end + def get( + "http://gs.example.org:4040/index.php/user/1", + _, + _, + Accept: "application/activity+json" + ) do + {:ok, %Tesla.Env{status: 406, body: ""}} + end + def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _, _, _) do {:ok, %Tesla.Env{ @@ -728,6 +757,14 @@ defmodule HttpRequestMock do {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}} end + def get("http://example.com/ogp-missing-data", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/rich_media/ogp-missing-data.html") + }} + end + def get("http://example.com/malformed", _, _, _) do {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/malformed-data.html")}} @@ -765,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{ diff --git a/test/support/ostatus_mock.ex b/test/support/ostatus_mock.ex deleted file mode 100644 index 9c0f2f323..000000000 --- a/test/support/ostatus_mock.ex +++ /dev/null @@ -1,11 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.OStatusMock do - import Pleroma.Factory - - def handle_incoming(_doc) do - insert(:note_activity) - end -end diff --git a/test/support/websub_mock.ex b/test/support/websub_mock.ex deleted file mode 100644 index e3d5a5b16..000000000 --- a/test/support/websub_mock.ex +++ /dev/null @@ -1,9 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.WebsubMock do - def verify(sub) do - {:ok, sub} - end -end |