diff options
author | lain <lain@soykaf.club> | 2018-04-02 15:17:09 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-04-02 15:17:09 +0200 |
commit | bc31bee7c4d5fc96d4c1923b61db7489b78f4558 (patch) | |
tree | 9134ba9fdfa9627e609868e826d13f8d32d8f1a8 /test | |
parent | a4db3a732fba1b3f01d875d040bd4587f9c0c5f3 (diff) | |
download | pleroma-bc31bee7c4d5fc96d4c1923b61db7489b78f4558.tar.gz pleroma-bc31bee7c4d5fc96d4c1923b61db7489b78f4558.zip |
Generates contexts and ids on insertion time.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index cf25abfc1..c6434f789 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -40,12 +40,31 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do data = %{ "ok" => true, - "id" => given_id + "id" => given_id, + "context" => "blabla" } {:ok, %Activity{} = activity} = ActivityPub.insert(data) assert activity.data["ok"] == data["ok"] assert activity.data["id"] == given_id + assert activity.data["context"] == "blabla" + assert activity.data["context_id"] + end + + test "adds a context when none is there" do + data = %{ + "id" => "some_id", + "object" => %{ + "id" => "object_id" + } + } + + {:ok, %Activity{} = activity} = ActivityPub.insert(data) + + assert is_binary(activity.data["context"]) + assert is_binary(activity.data["object"]["context"]) + assert activity.data["context_id"] + assert activity.data["object"]["context_id"] end test "adds an id to a given object if it lacks one and is a note and inserts it to the object database" do |