summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorClaudio Maradonna <penguyman@stronzi.org>2022-05-09 12:15:40 +0200
committerClaudio Maradonna <penguyman@stronzi.org>2022-07-07 06:29:13 +0200
commit7c1af86f979ecebcd38995e5278fe2d59a36eda5 (patch)
treea205ae5ee8c61f4315f62fb68ac9839563608e31 /test
parent44659ecd65fb2251f9130fcecf1732b8931104c1 (diff)
downloadpleroma-7c1af86f979ecebcd38995e5278fe2d59a36eda5.tar.gz
pleroma-7c1af86f979ecebcd38995e5278fe2d59a36eda5.zip
ipfs: refactor final_url generation. add tests for final_url
fix lint
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/uploaders/ipfs_test.exs13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/pleroma/uploaders/ipfs_test.exs b/test/pleroma/uploaders/ipfs_test.exs
index fc87fa378..d567272d2 100644
--- a/test/pleroma/uploaders/ipfs_test.exs
+++ b/test/pleroma/uploaders/ipfs_test.exs
@@ -23,6 +23,16 @@ defmodule Pleroma.Uploaders.IPFSTest do
clear_config([Pleroma.Uploaders.IPFS, :post_gateway_url], "http://localhost:5001")
end
+ describe "get_final_url" do
+ test "it returns the final url for put_file" do
+ assert IPFS.get_final_url("/api/v0/add") == "http://localhost:5001/api/v0/add"
+ end
+
+ test "it returns the final url for delete_file" do
+ assert IPFS.get_final_url("/api/v0/files/rm") == "http://localhost:5001/api/v0/files/rm"
+ end
+ end
+
describe "get_file/1" do
test "it returns path to ipfs file with cid as subdomain" do
assert IPFS.get_file("testcid") == {
@@ -62,7 +72,8 @@ defmodule Pleroma.Uploaders.IPFSTest do
{:ok,
%Tesla.Env{
status: 200,
- body: "{\"Hash\":\"bafybeicrh7ltzx52yxcwrvxxckfmwhqdgsb6qym6dxqm2a4ymsakeshwoi\"}"
+ body:
+ "{\"Name\":\"image-tet.jpg\",\"Size\":\"5000\", \"Hash\":\"bafybeicrh7ltzx52yxcwrvxxckfmwhqdgsb6qym6dxqm2a4ymsakeshwoi\"}"
}}
end do
assert IPFS.put_file(file_upload) ==