1 defmodule Pleroma.HTTPTest do
9 url: "http://example.com/hello",
10 headers: [{"content-type", "application/json"}]
12 json(%{"my" => "data"})
14 %{method: :get, url: "http://example.com/hello"} ->
15 %Tesla.Env{status: 200, body: "hello"}
17 %{method: :post, url: "http://example.com/world"} ->
18 %Tesla.Env{status: 200, body: "world"}
25 test "returns successfully result" do
26 assert Pleroma.HTTP.get("http://example.com/hello") == {
28 %Tesla.Env{status: 200, body: "hello"}
33 describe "get/2 (with headers)" do
34 test "returns successfully result for json content-type" do
35 assert Pleroma.HTTP.get("http://example.com/hello", [{"content-type", "application/json"}]) ==
40 body: "{\"my\":\"data\"}",
41 headers: [{"content-type", "application/json"}]
48 test "returns successfully result" do
49 assert Pleroma.HTTP.post("http://example.com/world", "") == {
51 %Tesla.Env{status: 200, body: "world"}