HTTP header improvements (#294)
[akkoma] / test / pleroma / web / plugs / http_signature_plug_test.exs
index 56ef6b06f86f4ec82dcf313d5f8ccbd38aa53699..8ce9565103344378ad36001e36ab4f38c0ecd040 100644 (file)
@@ -4,6 +4,7 @@
 
 defmodule Pleroma.Web.Plugs.HTTPSignaturePlugTest do
   use Pleroma.Web.ConnCase
+  import Pleroma.Factory
   alias Pleroma.Web.Plugs.HTTPSignaturePlug
 
   import Plug.Conn
@@ -81,5 +82,16 @@ defmodule Pleroma.Web.Plugs.HTTPSignaturePlugTest do
       assert conn.state == :sent
       assert conn.resp_body == "Request not signed"
     end
+
+    test "aliases redirected /object endpoints", _ do
+      obj = insert(:note)
+      act = insert(:note_activity, note: obj)
+      params = %{"actor" => "someparam"}
+      path = URI.parse(obj.data["id"]).path
+      conn = build_conn(:get, path, params)
+
+      assert ["/notice/#{act.id}", "/notice/#{act.id}?actor=someparam"] ==
+               HTTPSignaturePlug.route_aliases(conn)
+    end
   end
 end