Merge branch 'patch-image-description' into 'develop'
[akkoma] / test / support / factory.ex
index 964b2b61c6b8354cfebf2c5ae5bb832dee819e37..7a91549f5eb687c591035879edf2c7c173c10ba6 100644 (file)
@@ -220,4 +220,24 @@ defmodule Pleroma.Factory do
       client_secret: "aaa;/&bbb"
     }
   end
+
+  def instance_factory do
+    %Pleroma.Instances.Instance{
+      host: "domain.com",
+      unreachable_since: nil
+    }
+  end
+
+  def oauth_token_factory do
+    user = insert(:user)
+    oauth_app = insert(:oauth_app)
+
+    %Pleroma.Web.OAuth.Token{
+      token: :crypto.strong_rand_bytes(32) |> Base.url_encode64(),
+      refresh_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64(),
+      user_id: user.id,
+      app_id: oauth_app.id,
+      valid_until: NaiveDateTime.add(NaiveDateTime.utc_now(), 60 * 10)
+    }
+  end
 end