test: httpoison mock: add second spoofing activity test
authorWilliam Pitcock <nenolod@dereferenced.org>
Sat, 17 Nov 2018 17:42:47 +0000 (17:42 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sat, 17 Nov 2018 18:11:17 +0000 (18:11 +0000)
test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json [new file with mode: 0644]
test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json [new file with mode: 0644]
test/support/httpoison_mock.ex

diff --git a/test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json b/test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json
new file mode 100644 (file)
index 0000000..9dabf0e
--- /dev/null
@@ -0,0 +1,17 @@
+{
+    "@context": "https://www.w3.org/ns/activitystreams",
+    "id": "https://info.pleroma.site/actor.json",
+    "type": "Person",
+    "following": "https://info.pleroma.site/following.json",
+    "followers": "https://info.pleroma.site/followers.json",
+    "inbox": "https://info.pleroma.site/inbox.json",
+    "outbox": "https://info.pleroma.site/outbox.json",
+    "preferredUsername": "admin",
+    "name": null,
+    "summary": "<p></p>",
+    "publicKey": {
+        "id": "https://info.pleroma.site/actor.json#main-key",
+        "owner": "https://info.pleroma.site/actor.json",
+        "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtc4Tir+3ADhSNF6VKrtW\nOU32T01w7V0yshmQei38YyiVwVvFu8XOP6ACchkdxbJ+C9mZud8qWaRJKVbFTMUG\nNX4+6Q+FobyuKrwN7CEwhDALZtaN2IPbaPd6uG1B7QhWorrY+yFa8f2TBM3BxnUy\nI4T+bMIZIEYG7KtljCBoQXuTQmGtuffO0UwJksidg2ffCF5Q+K//JfQagJ3UzrR+\nZXbKMJdAw4bCVJYs4Z5EhHYBwQWiXCyMGTd7BGlmMkY6Av7ZqHKC/owp3/0EWDNz\nNqF09Wcpr3y3e8nA10X40MJqp/wR+1xtxp+YGbq/Cj5hZGBG7etFOmIpVBrDOhry\nBwIDAQAB\n-----END PUBLIC KEY-----\n"
+    }
+}
diff --git a/test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json b/test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json
new file mode 100644 (file)
index 0000000..8ce3595
--- /dev/null
@@ -0,0 +1,14 @@
+{
+        "@context": "https://www.w3.org/ns/activitystreams",
+        "attributedTo": "https://info.pleroma.site/actor.json",
+        "attachment": [],
+        "actor": "https://mastodon.example.org/users/admin",
+        "content": "<p>this post was not actually written by Haelwenn</p>",
+        "id": "https://info.pleroma.site/activity2.json",
+        "published": "2018-09-01T22:15:00Z",
+        "tag": [],
+        "to": [
+            "https://www.w3.org/ns/activitystreams#Public"
+        ],
+        "type": "Note"
+}
index ab964334da72f67e07005e3993af9a7abacb7b59..2ea10910e5c3a3d2c636061712d7a32fc2d08f5d 100644 (file)
@@ -40,6 +40,22 @@ defmodule HTTPoisonMock do
      }}
   end
 
+  def get("https://info.pleroma.site/activity2.json", _, _) do
+    {:ok,
+     %Response{
+       status_code: 200,
+       body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json")
+     }}
+  end
+
+  def get("https://info.pleroma.site/actor.json", _, _) do
+    {:ok,
+     %Response{
+       status_code: 200,
+       body: File.read!("test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json")
+     }}
+  end
+
   def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
     {:ok,
      %Response{