Add all
This commit is contained in:
parent
b35e18cd20
commit
82f55f7afe
80 changed files with 6687 additions and 5 deletions
60
test/support/fixtures/actors_fixtures.ex
Normal file
60
test/support/fixtures/actors_fixtures.ex
Normal file
|
@ -0,0 +1,60 @@
|
|||
defmodule Nulla.ActorsFixtures do
|
||||
alias Nulla.KeyGen
|
||||
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
entities via the `Nulla.Actors` context.
|
||||
"""
|
||||
|
||||
@doc """
|
||||
Generate a actor.
|
||||
"""
|
||||
def actor_fixture(attrs \\ %{}) do
|
||||
username = "test#{System.unique_integer()}"
|
||||
{publicKeyPem, privateKeyPem} = KeyGen.gen()
|
||||
|
||||
attrs =
|
||||
Enum.into(attrs, %{
|
||||
acct: "#{username}@localhost",
|
||||
ap_id: "http://localhost/users/#{username}",
|
||||
attachment: [],
|
||||
discoverable: true,
|
||||
endpoints: %{},
|
||||
featured: "some featured",
|
||||
featuredTags: "some featuredTags",
|
||||
followers: "some followers",
|
||||
following: "some following",
|
||||
icon: %{},
|
||||
image: %{},
|
||||
inbox: "some inbox",
|
||||
indexable: true,
|
||||
manuallyApprovesFollowers: true,
|
||||
memorial: true,
|
||||
name: "some name",
|
||||
outbox: "some outbox",
|
||||
preferredUsername: username,
|
||||
publicKey: %{
|
||||
"id" => "http://localhost/users/#{username}#main-key",
|
||||
"owner" => "http://localhost/users/#{username}",
|
||||
"publicKeyPem" => publicKeyPem
|
||||
},
|
||||
privateKeyPem: privateKeyPem,
|
||||
published: ~U[2025-06-30 13:31:00Z],
|
||||
summary: "some summary",
|
||||
tag: [],
|
||||
type: "some type",
|
||||
url: "some url",
|
||||
vcard_Address: "some vcard_Address",
|
||||
vcard_bday: ~D[2025-06-30]
|
||||
})
|
||||
|
||||
case Nulla.Actors.create_actor(attrs) do
|
||||
{:ok, actor} ->
|
||||
actor
|
||||
|
||||
{:error, changeset} ->
|
||||
IO.inspect(changeset, label: "Actor creation failed")
|
||||
raise "Failed to create actor fixture"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue