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