Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

30 satır
900B

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2018 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