summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-04-11 13:20:46 +0200
committerlain <lain@soykaf.club>2019-04-11 13:20:46 +0200
commit36ec8d969405fc8e58a43100554c358fbeb6b4fc (patch)
tree00f3469ee8ca214aa71b526f1ae411fea83bc52f
parentd115d2a27e2e7a9df466fc4393416f804cb7e8e2 (diff)
downloadpleroma-36ec8d969405fc8e58a43100554c358fbeb6b4fc.tar.gz
pleroma-36ec8d969405fc8e58a43100554c358fbeb6b4fc.zip
ActivityPub: Fix specs.
-rw-r--r--test/web/activity_pub/activity_pub_test.exs48
1 files changed, 41 insertions, 7 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs
index 17fec05b1..c3911500e 100644
--- a/test/web/activity_pub/activity_pub_test.exs
+++ b/test/web/activity_pub/activity_pub_test.exs
@@ -126,9 +126,15 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
end
test "doesn't drop activities with content being null" do
+ user = insert(:user)
+
data = %{
- "ok" => true,
+ "actor" => user.ap_id,
+ "to" => [],
"object" => %{
+ "actor" => user.ap_id,
+ "to" => [],
+ "type" => "Note",
"content" => nil
}
}
@@ -144,8 +150,17 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
end
test "inserts a given map into the activity database, giving it an id if it has none." do
+ user = insert(:user)
+
data = %{
- "ok" => true
+ "actor" => user.ap_id,
+ "to" => [],
+ "object" => %{
+ "actor" => user.ap_id,
+ "to" => [],
+ "type" => "Note",
+ "content" => "hey"
+ }
}
{:ok, %Activity{} = activity} = ActivityPub.insert(data)
@@ -155,9 +170,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
given_id = "bla"
data = %{
- "ok" => true,
"id" => given_id,
- "context" => "blabla"
+ "actor" => user.ap_id,
+ "to" => [],
+ "context" => "blabla",
+ "object" => %{
+ "actor" => user.ap_id,
+ "to" => [],
+ "type" => "Note",
+ "content" => "hey"
+ }
}
{:ok, %Activity{} = activity} = ActivityPub.insert(data)
@@ -168,10 +190,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
end
test "adds a context when none is there" do
+ user = insert(:user)
+
data = %{
- "id" => "some_id",
+ "actor" => user.ap_id,
+ "to" => [],
"object" => %{
- "id" => "object_id"
+ "actor" => user.ap_id,
+ "to" => [],
+ "type" => "Note",
+ "content" => "hey"
}
}
@@ -184,10 +212,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
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
+ user = insert(:user)
+
data = %{
+ "actor" => user.ap_id,
+ "to" => [],
"object" => %{
+ "actor" => user.ap_id,
+ "to" => [],
"type" => "Note",
- "ok" => true
+ "content" => "hey"
}
}