projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'flake-from-int' into 'develop'
[akkoma]
/
test
/
support
/
http_request_mock.ex
diff --git
a/test/support/http_request_mock.ex
b/test/support/http_request_mock.ex
index 391342ad78bf464ae8331352d9f7b05b3a5ee40c..3043d2be6953b31686f04ceb2f5ebbf920829c37 100644
(file)
--- a/
test/support/http_request_mock.ex
+++ b/
test/support/http_request_mock.ex
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule HttpRequestMock do
require Logger
defmodule HttpRequestMock do
require Logger
@@
-13,7
+17,7
@@
defmodule HttpRequestMock do
with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do
res
else
with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do
res
else
- {_, r} = error ->
+ {_,
_
r} = error ->
# Logger.warn(r)
error
end
# Logger.warn(r)
error
end
@@
-649,6
+653,14
@@
defmodule HttpRequestMock do
{:ok, Tesla.Mock.json(%{"id" => "https://social.heldscal.la/user/23211"}, status: 200)}
end
{:ok, Tesla.Mock.json(%{"id" => "https://social.heldscal.la/user/23211"}, status: 200)}
end
+ def get("http://example.com/ogp", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}}
+ end
+
+ def get("http://example.com/empty", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: "hello"}}
+ end
+
def get(url, query, body, headers) do
{:error,
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{
def get(url, query, body, headers) do
{:error,
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{