diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-05-08 21:37:55 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-05-08 21:37:55 +0300 |
commit | b2924ab1fbba4e6add15030cf8444d2d3f0cfe0c (patch) | |
tree | 000420341c4397cb7e380ff6fa52bb023700476a /test/signature_test.exs | |
parent | d5cdc907e3fda14c2ce78ddbb124739441330ecc (diff) | |
parent | 570940a3fd8d5a2fb600656432dfc01304161221 (diff) | |
download | pleroma-b2924ab1fbba4e6add15030cf8444d2d3f0cfe0c.tar.gz |
Merge remote-tracking branch 'remotes/origin/develop' into restricted-relations-embedding
Diffstat (limited to 'test/signature_test.exs')
-rw-r--r-- | test/signature_test.exs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/signature_test.exs b/test/signature_test.exs index d5a2a62c4..a7a75aa4d 100644 --- a/test/signature_test.exs +++ b/test/signature_test.exs @@ -44,7 +44,8 @@ defmodule Pleroma.SignatureTest do test "it returns error when not found user" do assert capture_log(fn -> - assert Signature.fetch_public_key(make_fake_conn("test-ap_id")) == {:error, :error} + assert Signature.fetch_public_key(make_fake_conn("https://test-ap-id")) == + {:error, :error} end) =~ "[error] Could not decode user" end @@ -64,7 +65,7 @@ defmodule Pleroma.SignatureTest do test "it returns error when not found user" do assert capture_log(fn -> - {:error, _} = Signature.refetch_public_key(make_fake_conn("test-ap_id")) + {:error, _} = Signature.refetch_public_key(make_fake_conn("https://test-ap_id")) end) =~ "[error] Could not decode user" end end @@ -100,12 +101,21 @@ defmodule Pleroma.SignatureTest do describe "key_id_to_actor_id/1" do test "it properly deduces the actor id for misskey" do assert Signature.key_id_to_actor_id("https://example.com/users/1234/publickey") == - "https://example.com/users/1234" + {:ok, "https://example.com/users/1234"} end test "it properly deduces the actor id for mastodon and pleroma" do assert Signature.key_id_to_actor_id("https://example.com/users/1234#main-key") == - "https://example.com/users/1234" + {:ok, "https://example.com/users/1234"} + end + + test "it calls webfinger for 'acct:' accounts" do + with_mock(Pleroma.Web.WebFinger, + finger: fn _ -> %{"ap_id" => "https://gensokyo.2hu/users/raymoo"} end + ) do + assert Signature.key_id_to_actor_id("acct:raymoo@gensokyo.2hu") == + {:ok, "https://gensokyo.2hu/users/raymoo"} + end end end |