Merge branch 'feature/oauth-token-password' into 'develop'
[akkoma] / test / object_test.exs
1 defmodule Pleroma.ObjectTest do
2 use Pleroma.DataCase
3 import Pleroma.Factory
4 alias Pleroma.{Repo, Object}
5
6 test "returns an object by it's AP id" do
7 object = insert(:note)
8 found_object = Object.get_by_ap_id(object.data["id"])
9
10 assert object == found_object
11 end
12
13 describe "generic changeset" do
14 test "it ensures uniqueness of the id" do
15 object = insert(:note)
16 cs = Object.change(%Object{}, %{data: %{id: object.data["id"]}})
17 assert cs.valid?
18
19 {:error, _result} = Repo.insert(cs)
20 end
21 end
22 end