X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fsupport%2Fhttpoison_mock.ex;h=54375d92974c2c7c21bb4ac2c626f49d7d7a2ecc;hb=a92a9dce94d2a2502750a4a258560283c21e2777;hp=733abced22c5f8b227947c10d644881ceba549ca;hpb=fa2610c7959500c18b64d70828123a817de78864;p=akkoma diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index 733abced2..54375d929 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -16,14 +16,14 @@ defmodule HTTPoisonMock do 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"], [params: [resource: "https://social.heldscal.la/user/23211"]]) 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"], [params: [resource: "https://social.heldscal.la/user/29191"]]) do {:ok, %Response{ status_code: 200, @@ -115,8 +115,42 @@ defmodule HTTPoisonMock do }} 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("https://pawoo.net/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "https://pawoo.net/users/pekorino"]]) 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"], [params: [resource: "https://mamot.fr/users/Skruyb"]]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom") + }} + 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(url, body, headers) do - {:error, "Not implemented the mock response for get #{inspect(url)}"} + {:error, "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{inspect(headers)}"} end def post(url, body, headers) do