summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/signature_test.exs5
-rw-r--r--test/pleroma/user_test.exs4
-rw-r--r--test/pleroma/web/plugs/frontend_static_plug_test.exs1
-rw-r--r--test/pleroma/web/twitter_api/remote_follow_controller_test.exs34
4 files changed, 38 insertions, 6 deletions
diff --git a/test/pleroma/signature_test.exs b/test/pleroma/signature_test.exs
index b849cbee7..f5a915fa8 100644
--- a/test/pleroma/signature_test.exs
+++ b/test/pleroma/signature_test.exs
@@ -43,10 +43,7 @@ defmodule Pleroma.SignatureTest do
end
test "it returns error when not found user" do
- assert capture_log(fn ->
- assert Signature.fetch_public_key(make_fake_conn("https://test-ap-id")) ==
- {:error, :error}
- end) =~ "[error] Could not decode user"
+ assert Signature.fetch_public_key(make_fake_conn("https://test-ap-id")) == {:error, :error}
end
test "it returns error if public key is nil" do
diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs
index b9df527a0..77ca9198b 100644
--- a/test/pleroma/user_test.exs
+++ b/test/pleroma/user_test.exs
@@ -1951,8 +1951,8 @@ defmodule Pleroma.UserTest do
end
end
- test "get_public_key_for_ap_id fetches a user that's not in the db" do
- assert {:ok, _key} = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
+ test "get_public_key_for_ap_id returns correctly for user that's not in the db" do
+ assert :error = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
end
describe "per-user rich-text filtering" do
diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs
index 6d6ac0f8e..6f4d24d9e 100644
--- a/test/pleroma/web/plugs/frontend_static_plug_test.exs
+++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs
@@ -89,6 +89,7 @@ defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do
"api",
"main",
"ostatus_subscribe",
+ "authorize_interaction",
"oauth",
"objects",
"activities",
diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs
index b0812667e..41f8ebcd7 100644
--- a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs
+++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs
@@ -460,4 +460,38 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
assert avatar_url == "#{Pleroma.Web.Endpoint.url()}/localuser/avatar.png"
end
end
+
+ describe "GET /authorize_interaction - authorize_interaction/2" do
+ test "redirects to /ostatus_subscribe", %{conn: conn} do
+ Tesla.Mock.mock(fn
+ %{method: :get, url: "https://mastodon.social/users/emelie"} ->
+ %Tesla.Env{
+ status: 200,
+ headers: [{"content-type", "application/activity+json"}],
+ body: File.read!("test/fixtures/tesla_mock/emelie.json")
+ }
+
+ %{method: :get, url: "https://mastodon.social/users/emelie/collections/featured"} ->
+ %Tesla.Env{
+ status: 200,
+ headers: [{"content-type", "application/activity+json"}],
+ body:
+ File.read!("test/fixtures/users_mock/masto_featured.json")
+ |> String.replace("{{domain}}", "mastodon.social")
+ |> String.replace("{{nickname}}", "emelie")
+ }
+ end)
+
+ conn =
+ conn
+ |> get(
+ remote_follow_path(conn, :authorize_interaction, %{
+ uri: "https://mastodon.social/users/emelie"
+ })
+ )
+
+ assert redirected_to(conn) ==
+ remote_follow_path(conn, :follow, %{acct: "https://mastodon.social/users/emelie"})
+ end
+ end
end