diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-07-29 19:01:15 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-08-14 14:52:54 +0700 |
commit | 5178f960c3f5a35e2071bd5463b537cadc9a53af (patch) | |
tree | 8359958c4e16cf18454b83c272b3296fcc8c5fad /test/web | |
parent | 8ab87ce40b0b8a5be7cd3576eddbacc279d8d3a1 (diff) | |
download | pleroma-5178f960c3f5a35e2071bd5463b537cadc9a53af.tar.gz pleroma-5178f960c3f5a35e2071bd5463b537cadc9a53af.zip |
Support user attachment update in Transmogrifier
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 060b91e29..05ec09ec1 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -509,6 +509,42 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert user.bio == "<p>Some bio</p>" end + test "it works with custom profile fields" do + {:ok, activity} = + "test/fixtures/mastodon-post-activity.json" + |> File.read!() + |> Poison.decode!() + |> Transmogrifier.handle_incoming() + + user = User.get_cached_by_ap_id(activity.actor) + + assert user.info.source_data["attachment"] == [ + %{"name" => "foo", "type" => "PropertyValue", "value" => "bar"}, + %{"name" => "foo1", "type" => "PropertyValue", "value" => "bar1"} + ] + + update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!() + + object = + update_data["object"] + |> Map.put("actor", user.ap_id) + |> Map.put("id", user.ap_id) + + update_data = + update_data + |> Map.put("actor", user.ap_id) + |> Map.put("object", object) + + {:ok, _update_activity} = Transmogrifier.handle_incoming(update_data) + + user = User.get_cached_by_ap_id(user.ap_id) + + assert user.info.source_data["attachment"] == [ + %{"name" => "foo", "type" => "PropertyValue", "value" => "updated"}, + %{"name" => "foo1", "type" => "PropertyValue", "value" => "updated"} + ] + end + test "it works for incoming update activities which lock the account" do data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!() |