Webfinger fixes.
This commit is contained in:
parent
5bd3b3a215
commit
3c61df6b9e
|
@ -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)
|
||||
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue