1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Plugs.HTTPSignaturePlugTest do
6 use Pleroma.Web.ConnCase
7 alias Pleroma.Web.Plugs.HTTPSignaturePlug
12 test "it call HTTPSignatures to check validity if the actor sighed it" do
13 params = %{"actor" => "http://mastodon.example.org/users/admin"}
14 conn = build_conn(:get, "/doesntmattter", params)
16 with_mock HTTPSignatures, validate_conn: fn _ -> true end do
21 "keyId=\"http://mastodon.example.org/users/admin#main-key"
23 |> HTTPSignaturePlug.call(%{})
25 assert conn.assigns.valid_signature == true
26 assert called(HTTPSignatures.validate_conn(:_))