X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fhttp_sigs%2Fhttp_sig_test.exs;h=c4d2eaf78d433cdf2abfac026c9c40fc49280fe7;hb=bee6acd51dc4e84e44caecf9d123dfff2f640a38;hp=b54afa3fb95297212b90a3ef8a1ee3bd098558b3;hpb=a9f78fe8e07df1fdd51f235090cd35b09c73aa34;p=akkoma diff --git a/test/web/http_sigs/http_sig_test.exs b/test/web/http_sigs/http_sig_test.exs index b54afa3fb..c4d2eaf78 100644 --- a/test/web/http_sigs/http_sig_test.exs +++ b/test/web/http_sigs/http_sig_test.exs @@ -1,12 +1,19 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + # http signatures # Test data from https://tools.ietf.org/html/draft-cavage-http-signatures-08#appendix-C defmodule Pleroma.Web.HTTPSignaturesTest do use Pleroma.DataCase alias Pleroma.Web.HTTPSignatures import Pleroma.Factory + import Tesla.Mock - @private_key hd(:public_key.pem_decode(File.read!("test/web/http_sigs/priv.key"))) - |> :public_key.pem_entry_decode() + setup do + mock(fn env -> apply(HttpRequestMock, :request, [env]) end) + :ok + end @public_key hd(:public_key.pem_decode(File.read!("test/web/http_sigs/pub.key"))) |> :public_key.pem_entry_decode() @@ -20,8 +27,6 @@ defmodule Pleroma.Web.HTTPSignaturesTest do "content-length" => "18" } - @body "{\"hello\": \"world\"}" - @default_signature """ keyId="Test",algorithm="rsa-sha256",signature="jKyvPcxB4JbmYY4mByyBY7cZfNl4OW9HpFQlG7N4YcJPteKTu4MWCLyk+gIr0wDgqtLWf9NLpMAMimdfsH7FSWGfbMFSrsVTHNTk0rK3usrfFnti1dxsM4jl0kYJCKTGI/UWkqiaxwNiKqGcdlEDrTcUhhsFsOIo8VhddmZTZ8w=" """ @@ -183,6 +188,7 @@ defmodule Pleroma.Web.HTTPSignaturesTest do {"(request-target)", "post /inbox"} ] } + assert HTTPSignatures.validate_conn(conn) end end