summaryrefslogtreecommitdiff
path: root/test/web/ostatus
diff options
context:
space:
mode:
Diffstat (limited to 'test/web/ostatus')
-rw-r--r--test/web/ostatus/activity_representer_test.exs2
-rw-r--r--test/web/ostatus/ostatus_controller_test.exs2
-rw-r--r--test/web/ostatus/ostatus_test.exs22
-rw-r--r--test/web/ostatus/user_representer_test.exs1
4 files changed, 17 insertions, 10 deletions
diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs
index 0a66b819a..3ee9034a7 100644
--- a/test/web/ostatus/activity_representer_test.exs
+++ b/test/web/ostatus/activity_representer_test.exs
@@ -121,6 +121,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
#{note_xml}
</activity:object>
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="#{note.data["actor"]}"/>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
"""
announce_xml = ActivityRepresenter.to_simple_form(announce, user)
@@ -156,6 +157,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
<link rel="self" type="application/atom+xml" href="#{like.data["id"]}"/>
<thr:in-reply-to ref="#{note.data["id"]}" />
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="#{note.data["actor"]}"/>
+ <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
"""
assert clean(res) == clean(expected)
diff --git a/test/web/ostatus/ostatus_controller_test.exs b/test/web/ostatus/ostatus_controller_test.exs
index 0c75ce06f..5b8eb8156 100644
--- a/test/web/ostatus/ostatus_controller_test.exs
+++ b/test/web/ostatus/ostatus_controller_test.exs
@@ -43,7 +43,7 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
conn = conn
|> get("/users/#{user.nickname}/feed.atom")
- assert response(conn, 200)
+ assert response(conn, 200) =~ note_activity.data["object"]["content"]
end
test "gets an object", %{conn: conn} do
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs
index 1f10ea4d2..7f67b9ec0 100644
--- a/test/web/ostatus/ostatus_test.exs
+++ b/test/web/ostatus/ostatus_test.exs
@@ -90,6 +90,15 @@ defmodule Pleroma.Web.OStatusTest do
assert "https://www.w3.org/ns/activitystreams#Public" in activity.data["to"]
end
+ test "handle incoming unlisted messages, put public into cc" do
+ incoming = File.read!("test/fixtures/mastodon-note-unlisted.xml")
+ {:ok, [activity]} = OStatus.handle_incoming(incoming)
+ refute "https://www.w3.org/ns/activitystreams#Public" in activity.data["to"]
+ assert "https://www.w3.org/ns/activitystreams#Public" in activity.data["cc"]
+ refute "https://www.w3.org/ns/activitystreams#Public" in activity.data["object"]["to"]
+ assert "https://www.w3.org/ns/activitystreams#Public" in activity.data["object"]["cc"]
+ end
+
test "handle incoming retweets - Mastodon, with CW" do
incoming = File.read!("test/fixtures/cw_retweet.xml")
{:ok, [[_activity, retweeted_activity]]} = OStatus.handle_incoming(incoming)
@@ -306,7 +315,8 @@ defmodule Pleroma.Web.OStatusTest do
"fqn" => user,
"bio" => "cofe",
"avatar" => %{"type" => "Image", "url" => [%{"href" => "https://social.heldscal.la/avatar/29191-original-20170421154949.jpeg", "mediaType" => "image/jpeg", "type" => "Link"}]},
- "subscribe_address" => "https://social.heldscal.la/main/ostatussub?profile={uri}"
+ "subscribe_address" => "https://social.heldscal.la/main/ostatussub?profile={uri}",
+ "ap_id" => nil
}
assert data == expected
end
@@ -330,7 +340,8 @@ defmodule Pleroma.Web.OStatusTest do
"fqn" => user,
"bio" => "cofe",
"avatar" => %{"type" => "Image", "url" => [%{"href" => "https://social.heldscal.la/avatar/29191-original-20170421154949.jpeg", "mediaType" => "image/jpeg", "type" => "Link"}]},
- "subscribe_address" => "https://social.heldscal.la/main/ostatussub?profile={uri}"
+ "subscribe_address" => "https://social.heldscal.la/main/ostatussub?profile={uri}",
+ "ap_id" => nil
}
assert data == expected
end
@@ -355,13 +366,6 @@ defmodule Pleroma.Web.OStatusTest do
end
end
- test "insert or update a user from given data" do
- user = insert(:user, %{nickname: "nick@name.de"})
- data = %{ ap_id: user.ap_id <> "xxx", name: user.name, nickname: user.nickname }
-
- assert {:ok, %User{}} = OStatus.insert_or_update_user(data)
- end
-
test "it doesn't add nil in the do field" do
incoming = File.read!("test/fixtures/nil_mention_entry.xml")
{:ok, [activity]} = OStatus.handle_incoming(incoming)
diff --git a/test/web/ostatus/user_representer_test.exs b/test/web/ostatus/user_representer_test.exs
index b22420379..e41dfeb3d 100644
--- a/test/web/ostatus/user_representer_test.exs
+++ b/test/web/ostatus/user_representer_test.exs
@@ -22,6 +22,7 @@ defmodule Pleroma.Web.OStatus.UserRepresenterTest do
<name>#{user.nickname}</name>
<link rel="avatar" href="#{User.avatar_url(user)}" />
<link rel="header" href="#{User.banner_url(user)}" />
+ <ap_enabled>true</ap_enabled>
"""
assert clean(res) == clean(expected)