Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

30 wiersze
900B

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