Browse Source

Test that prismo url-map transforms into a string

tags/v0.9.9
Haelwenn (lanodan) Monnier 5 years ago
parent
commit
c5f26f3ce2
No known key found for this signature in database GPG Key ID: D5B7A8E43C997DEE
2 changed files with 60 additions and 0 deletions
  1. +52
    -0
      test/fixtures/prismo-url-map.json
  2. +8
    -0
      test/web/activity_pub/transmogrifier_test.exs

+ 52
- 0
test/fixtures/prismo-url-map.json View File

@@ -0,0 +1,52 @@
{
"id": "https://prismo.news/posts/83",
"type": "Article",
"name": "Introducing: Federated follows!",
"published": "2018-11-01T07:10:05Z",
"content": "We are more than thrilled to announce that Prismo now supports federated follows! It means you ca...",
"url": {
"type": "Link",
"mimeType": "text/html",
"href": "https://prismo.news/posts/83"
},
"votes": 12,
"attributedTo": [
{
"type": "Person",
"id": "https://prismo.news/@mxb"
}
],
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"tags": [
{
"type": "Hashtag",
"href": "https://prismo.news/tags/prismo",
"name": "#prismo"
},
{
"type": "Hashtag",
"href": "https://prismo.news/tags/prismodev",
"name": "#prismodev"
},
{
"type": "Hashtag",
"href": "https://prismo.news/tags/meta",
"name": "#meta"
}
],
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"Hashtag": "as:Hashtag"
},
{
"votes": {
"@id": "as:votes",
"@type": "@id"
}
}
]
}

+ 8
- 0
test/web/activity_pub/transmogrifier_test.exs View File

@@ -145,6 +145,14 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
assert "test" in data["object"]["tag"]
end

test "it works for incoming notices with url not being a string (prismo)" do
data = File.read!("test/fixtures/prismo-url-map.json") |> Poison.decode!()

{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)

assert data["object"]["url"] == "https://prismo.news/posts/83"
end

test "it works for incoming follow requests" do
user = insert(:user)



Loading…
Cancel
Save