From 3c61df6b9ed4f66f0cc6ae6f1e7e167f7bfb2210 Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 27 Nov 2018 18:31:44 +0100 Subject: [PATCH] Webfinger fixes. --- lib/pleroma/web/web_finger/web_finger.ex | 4 ++-- test/web/web_finger/web_finger_test.exs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index 5bf529840..eaee3a8c6 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -45,7 +45,7 @@ def webfinger(resource, fmt) when fmt in ["XML", "JSON"] do def represent_user(user, "JSON") do {:ok, user} = ensure_keys_present(user) - {:ok, _private, public} = Salmon.keys_from_pem(user.info["keys"]) + {:ok, _private, public} = Salmon.keys_from_pem(user.info.keys) magic_key = Salmon.encode_key(public) %{ @@ -83,7 +83,7 @@ def represent_user(user, "JSON") do def represent_user(user, "XML") do {:ok, user} = ensure_keys_present(user) - {:ok, _private, public} = Salmon.keys_from_pem(user.info["keys"]) + {:ok, _private, public} = Salmon.keys_from_pem(user.info.keys) magic_key = Salmon.encode_key(public) { diff --git a/test/web/web_finger/web_finger_test.exs b/test/web/web_finger/web_finger_test.exs index 99bf210ea..28d429565 100644 --- a/test/web/web_finger/web_finger_test.exs +++ b/test/web/web_finger/web_finger_test.exs @@ -99,15 +99,15 @@ test "it gets the xrd endpoint for statusnet" do describe "ensure_keys_present" do test "it creates keys for a user and stores them in info" do user = insert(:user) - refute is_binary(user.info["keys"]) + refute is_binary(user.info.keys) {:ok, user} = WebFinger.ensure_keys_present(user) - assert is_binary(user.info["keys"]) + assert is_binary(user.info.keys) end test "it doesn't create keys if there already are some" do - user = insert(:user, %{info: %{"keys" => "xxx"}}) + user = insert(:user, %{info: %{keys: "xxx"}}) {:ok, user} = WebFinger.ensure_keys_present(user) - assert user.info["keys"] == "xxx" + assert user.info.keys == "xxx" end end end