Scrape instance nodeinfo (#251)
[akkoma] / test / support / factory.ex
index 54d385bc44f46278ce34d04232c9c2ee4f9cea88..bd9d7fe4251209124d29ecbdf64cc8e845cd7aab 100644 (file)
@@ -36,6 +36,15 @@ defmodule Pleroma.Factory do
     }
   end
 
+  def instance_factory(attrs \\ %{}) do
+    %Pleroma.Instances.Instance{
+      host: attrs[:domain] || "example.com",
+      nodeinfo: %{version: "2.0", openRegistrations: true},
+      unreachable_since: nil
+    }
+    |> Map.merge(attrs)
+  end
+
   def user_factory(attrs \\ %{}) do
     pem = Enum.random(@rsa_keys)
 
@@ -522,13 +531,6 @@ defmodule Pleroma.Factory do
     }
   end
 
-  def instance_factory do
-    %Pleroma.Instances.Instance{
-      host: "domain.com",
-      unreachable_since: nil
-    }
-  end
-
   def oauth_token_factory(attrs \\ %{}) do
     scopes = Map.get(attrs, :scopes, ["read"])
     oauth_app = Map.get_lazy(attrs, :app, fn -> insert(:oauth_app, scopes: scopes) end)