forked from AkkomaGang/akkoma
tests: add tests for endpoints
This commit is contained in:
parent
9bd6ed975e
commit
d54c483964
1 changed files with 28 additions and 0 deletions
|
@ -15,4 +15,32 @@ test "Renders a user, including the public key" do
|
||||||
|
|
||||||
assert String.contains?(result["publicKey"]["publicKeyPem"], "BEGIN PUBLIC KEY")
|
assert String.contains?(result["publicKey"]["publicKeyPem"], "BEGIN PUBLIC KEY")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "endpoints" do
|
||||||
|
test "local users have a usable endpoints structure" do
|
||||||
|
user = insert(:user)
|
||||||
|
{:ok, user} = Pleroma.Web.WebFinger.ensure_keys_present(user)
|
||||||
|
|
||||||
|
result = UserView.render("user.json", %{user: user})
|
||||||
|
|
||||||
|
assert result["id"] == user.ap_id
|
||||||
|
|
||||||
|
%{
|
||||||
|
"sharedInbox" => _,
|
||||||
|
"oauthAuthorizationEndpoint" => _,
|
||||||
|
"oauthRegistrationEndpoint" => _,
|
||||||
|
"oauthTokenEndpoint" => _
|
||||||
|
} = result["endpoints"]
|
||||||
|
end
|
||||||
|
|
||||||
|
test "remote users have an empty endpoints structure" do
|
||||||
|
user = insert(:user, local: false)
|
||||||
|
{:ok, user} = Pleroma.Web.WebFinger.ensure_keys_present(user)
|
||||||
|
|
||||||
|
result = UserView.render("user.json", %{user: user})
|
||||||
|
|
||||||
|
assert result["id"] == user.ap_id
|
||||||
|
assert result["endpoints"] == %{}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue