ActivityPub: Fix specs.
This commit is contained in:
parent
d115d2a27e
commit
36ec8d9694
|
@ -126,9 +126,15 @@ test "drops activities beyond a certain limit" do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "doesn't drop activities with content being null" do
|
test "doesn't drop activities with content being null" do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
data = %{
|
data = %{
|
||||||
"ok" => true,
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
"object" => %{
|
"object" => %{
|
||||||
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
|
"type" => "Note",
|
||||||
"content" => nil
|
"content" => nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,8 +150,17 @@ test "returns the activity if one with the same id is already in" do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "inserts a given map into the activity database, giving it an id if it has none." do
|
test "inserts a given map into the activity database, giving it an id if it has none." do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
data = %{
|
data = %{
|
||||||
"ok" => true
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
|
"object" => %{
|
||||||
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
|
"type" => "Note",
|
||||||
|
"content" => "hey"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, %Activity{} = activity} = ActivityPub.insert(data)
|
{:ok, %Activity{} = activity} = ActivityPub.insert(data)
|
||||||
|
@ -155,9 +170,16 @@ test "inserts a given map into the activity database, giving it an id if it has
|
||||||
given_id = "bla"
|
given_id = "bla"
|
||||||
|
|
||||||
data = %{
|
data = %{
|
||||||
"ok" => true,
|
|
||||||
"id" => given_id,
|
"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)
|
{:ok, %Activity{} = activity} = ActivityPub.insert(data)
|
||||||
|
@ -168,10 +190,16 @@ test "inserts a given map into the activity database, giving it an id if it has
|
||||||
end
|
end
|
||||||
|
|
||||||
test "adds a context when none is there" do
|
test "adds a context when none is there" do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
data = %{
|
data = %{
|
||||||
"id" => "some_id",
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
"object" => %{
|
"object" => %{
|
||||||
"id" => "object_id"
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
|
"type" => "Note",
|
||||||
|
"content" => "hey"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,10 +212,16 @@ test "adds a context when none is there" do
|
||||||
end
|
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
|
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 = %{
|
data = %{
|
||||||
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
"object" => %{
|
"object" => %{
|
||||||
|
"actor" => user.ap_id,
|
||||||
|
"to" => [],
|
||||||
"type" => "Note",
|
"type" => "Note",
|
||||||
"ok" => true
|
"content" => "hey"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue