summaryrefslogtreecommitdiff
path: root/test/web/ostatus
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-02-12 10:13:54 +0100
committerlain <lain@soykaf.club>2018-02-12 10:14:11 +0100
commit26ccb768d39515faa3b1db7f1371ecf2517eb6bf (patch)
treecad8d083afe1b126f6907cc6f9d1478c3e469656 /test/web/ostatus
parent33a5d0a2385984168f7de063093c6a71c8b07b73 (diff)
downloadpleroma-26ccb768d39515faa3b1db7f1371ecf2517eb6bf.tar.gz
pleroma-26ccb768d39515faa3b1db7f1371ecf2517eb6bf.zip
Make test output easier to read.
Diffstat (limited to 'test/web/ostatus')
-rw-r--r--test/web/ostatus/activity_representer_test.exs2
-rw-r--r--test/web/ostatus/incoming_documents/delete_handling_test.exs2
-rw-r--r--test/web/ostatus/ostatus_controller_test.exs7
-rw-r--r--test/web/ostatus/ostatus_test.exs41
4 files changed, 25 insertions, 27 deletions
diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs
index ed7fdc432..0a66b819a 100644
--- a/test/web/ostatus/activity_representer_test.exs
+++ b/test/web/ostatus/activity_representer_test.exs
@@ -96,7 +96,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
user = insert(:user)
object = Object.get_cached_by_ap_id(note.data["object"]["id"])
- {:ok, announce, object} = ActivityPub.announce(user, object)
+ {:ok, announce, _object} = ActivityPub.announce(user, object)
announce = Repo.get(Activity, announce.id)
diff --git a/test/web/ostatus/incoming_documents/delete_handling_test.exs b/test/web/ostatus/incoming_documents/delete_handling_test.exs
index 74c6a5994..43d04dea2 100644
--- a/test/web/ostatus/incoming_documents/delete_handling_test.exs
+++ b/test/web/ostatus/incoming_documents/delete_handling_test.exs
@@ -12,7 +12,7 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
user = insert(:user)
object = Object.get_by_ap_id(note.data["object"]["id"])
- {:ok, like, object} = Pleroma.Web.ActivityPub.ActivityPub.like(user, object)
+ {:ok, like, _object} = Pleroma.Web.ActivityPub.ActivityPub.like(user, object)
incoming = File.read!("test/fixtures/delete.xml")
|> String.replace("tag:mastodon.sdf.org,2017-06-10:objectId=310513:objectType=Status", note.data["object"]["id"])
diff --git a/test/web/ostatus/ostatus_controller_test.exs b/test/web/ostatus/ostatus_controller_test.exs
index 9c945e35b..0c75ce06f 100644
--- a/test/web/ostatus/ostatus_controller_test.exs
+++ b/test/web/ostatus/ostatus_controller_test.exs
@@ -84,10 +84,3 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
assert response(conn, 200)
end
end
-
-defmodule Pleroma.Web.OStatusMock do
- import Pleroma.Factory
- def handle_incoming(_doc) do
- insert(:note_activity)
- end
-end
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs
index b27f8cb55..1f10ea4d2 100644
--- a/test/web/ostatus/ostatus_test.exs
+++ b/test/web/ostatus/ostatus_test.exs
@@ -4,6 +4,7 @@ defmodule Pleroma.Web.OStatusTest do
alias Pleroma.Web.XML
alias Pleroma.{Object, Repo, User, Activity}
import Pleroma.Factory
+ import ExUnit.CaptureLog
test "don't insert create notes twice" do
incoming = File.read!("test/fixtures/incoming_note_activity.xml")
@@ -91,7 +92,7 @@ defmodule Pleroma.Web.OStatusTest do
test "handle incoming retweets - Mastodon, with CW" do
incoming = File.read!("test/fixtures/cw_retweet.xml")
- {:ok, [[activity, retweeted_activity]]} = OStatus.handle_incoming(incoming)
+ {:ok, [[_activity, retweeted_activity]]} = OStatus.handle_incoming(incoming)
assert retweeted_activity.data["object"]["summary"] == "Hey."
end
@@ -168,19 +169,21 @@ defmodule Pleroma.Web.OStatusTest do
end
test "handle incoming favorites - GS, websub" do
- incoming = File.read!("test/fixtures/favorite.xml")
- {:ok, [[activity, favorited_activity]]} = OStatus.handle_incoming(incoming)
-
- assert activity.data["type"] == "Like"
- assert activity.data["actor"] == "https://social.heldscal.la/user/23211"
- assert activity.data["object"] == favorited_activity.data["object"]["id"]
- assert activity.data["id"] == "tag:social.heldscal.la,2017-05-05:fave:23211:comment:2061643:2017-05-05T09:12:50+00:00"
-
- refute activity.local
- assert favorited_activity.data["type"] == "Create"
- assert favorited_activity.data["actor"] == "https://shitposter.club/user/1"
- assert favorited_activity.data["object"]["id"] == "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
- refute favorited_activity.local
+ capture_log fn ->
+ incoming = File.read!("test/fixtures/favorite.xml")
+ {:ok, [[activity, favorited_activity]]} = OStatus.handle_incoming(incoming)
+
+ assert activity.data["type"] == "Like"
+ assert activity.data["actor"] == "https://social.heldscal.la/user/23211"
+ assert activity.data["object"] == favorited_activity.data["object"]["id"]
+ assert activity.data["id"] == "tag:social.heldscal.la,2017-05-05:fave:23211:comment:2061643:2017-05-05T09:12:50+00:00"
+
+ refute activity.local
+ assert favorited_activity.data["type"] == "Create"
+ assert favorited_activity.data["actor"] == "https://shitposter.club/user/1"
+ assert favorited_activity.data["object"]["id"] == "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
+ refute favorited_activity.local
+ end
end
test "handle conversation references" do
@@ -335,11 +338,13 @@ defmodule Pleroma.Web.OStatusTest do
describe "fetching a status by it's HTML url" do
test "it builds a missing status from an html url" do
- url = "https://shitposter.club/notice/2827873"
- {:ok, [activity] } = OStatus.fetch_activity_from_url(url)
+ capture_log fn ->
+ url = "https://shitposter.club/notice/2827873"
+ {:ok, [activity] } = OStatus.fetch_activity_from_url(url)
- assert activity.data["actor"] == "https://shitposter.club/user/1"
- assert activity.data["object"]["id"] == "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
+ assert activity.data["actor"] == "https://shitposter.club/user/1"
+ assert activity.data["object"]["id"] == "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
+ end
end
test "it works for atom notes, too" do