Update nodeinfo_controller_test.exs

This commit is contained in:
Mirai Kumiko 2025-06-19 06:13:52 +02:00
parent 95df5ed0e0
commit 2d98fee0c3
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278

View file

@ -1,42 +1,46 @@
defmodule NullaWeb.NodeinfoControllerTest do defmodule NullaWeb.NodeinfoControllerTest do
use NullaWeb.ConnCase use NullaWeb.ConnCase
alias Nulla.KeyGen
alias Nulla.Models.User alias Nulla.Models.User
alias Nulla.Models.Actor alias Nulla.Models.Actor
setup do setup do
{:ok, actor} = Actor.create_actor(%{ {publicKeyPem, privateKeyPem} = KeyGen.gen()
domain: "localhost",
ap_id: "http://localhost/users/test", {:ok, actor} =
type: "Person", Actor.create_actor(%{
following: "http://localhost/users/test/following", domain: "localhost",
followers: "http://localhost/users/test/followers", ap_id: "http://localhost/users/test",
inbox: "http://localhost/users/test/inbox", type: "Person",
outbox: "http://localhost/users/test/outbox", following: "http://localhost/users/test/following",
featured: "http://localhost/users/test/collections/featured", followers: "http://localhost/users/test/followers",
featuredTags: "http://localhost/users/test/collections/tags", inbox: "http://localhost/users/test/inbox",
preferredUsername: "test", outbox: "http://localhost/users/test/outbox",
name: "Test", featured: "http://localhost/users/test/collections/featured",
summary: "Test User", featuredTags: "http://localhost/users/test/collections/tags",
url: "http://localhost/@test", preferredUsername: "test",
manuallyApprovesFollowers: false, name: "Test",
discoverable: true, summary: "Test User",
indexable: true, url: "http://localhost/@test",
published: DateTime.utc_now(), manuallyApprovesFollowers: false,
memorial: false, discoverable: true,
publicKey: indexable: true,
Jason.OrderedObject.new( published: DateTime.utc_now(),
id: "http://localhost/users/test#main-key", memorial: false,
owner: "http://localhost/users/test", publicKey:
publicKeyPem: "PUBLIC KEY" Jason.OrderedObject.new(
), id: "http://localhost/users/test#main-key",
endpoints: Jason.OrderedObject.new(sharedInbox: "http://localhost/inbox") owner: "http://localhost/users/test",
}) publicKeyPem: publicKeyPem
),
endpoints: Jason.OrderedObject.new(sharedInbox: "http://localhost/inbox")
})
User.create_user(%{ User.create_user(%{
id: actor.id, id: actor.id,
email: "test@localhost", email: "test@localhost",
password: "password", password: "password",
privateKeyPem: "PRIVATE KEY", privateKeyPem: privateKeyPem,
last_active_at: DateTime.utc_now() last_active_at: DateTime.utc_now()
}) })