logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: f0eb8e0b0c637104acaf95d8387a0d8f807e964f
parent fedae008c8b4a017b56a76c9a3b18bc031e520c8
Author: marcin mikołajczak <git@mkljczk.pl>
Date:   Thu, 25 Apr 2024 23:50:11 +0200

Add tests

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>

Diffstat:

Atest/fixtures/tesla_mock/deepl-translation.json2++
Mtest/support/http_request_mock.ex9+++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/test/fixtures/tesla_mock/deepl-translation.json b/test/fixtures/tesla_mock/deepl-translation.json @@ -0,0 +1 @@ +{"translations":[{"detected_source_language":"PL","text":"REMOVE THE FOLLOWER!Paste this on your follower. If we get 70% of nk users...they will remove the follower!!!"}]} +\ No newline at end of file diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex @@ -1569,6 +1569,15 @@ defmodule HttpRequestMock do }} end + def post("https://api-free.deepl.com/v2/translate" <> _, _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/deepl-translation.json"), + headers: [{"content-type", "application/json"}] + }} + end + def post(url, query, body, headers) do {:error, "Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"}