aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-05-24 17:34:38 +0200
committerRoger Braun <roger@rogerbraun.net>2017-05-24 17:34:38 +0200
commitbdcf42180fa67e43f13584d5e19f26d751199d03 (patch)
tree81f34e5ba4d52b3d4afc491fc46acd9dee200c34 /test
parent94e980d6b4ab91ee37c30b266eb91e748e23861c (diff)
downloadpleroma-bdcf42180fa67e43f13584d5e19f26d751199d03.tar.gz
Save remote user bio and update if we see new data.
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/lambadalambda.atom2
-rw-r--r--test/web/ostatus/ostatus_test.exs9
-rw-r--r--test/web/websub/websub_test.exs1
3 files changed, 10 insertions, 2 deletions
diff --git a/test/fixtures/lambadalambda.atom b/test/fixtures/lambadalambda.atom
index 35e506420..964a416f7 100644
--- a/test/fixtures/lambadalambda.atom
+++ b/test/fixtures/lambadalambda.atom
@@ -11,7 +11,7 @@
<uri>https://mastodon.social/users/lambadalambda</uri>
<name>lambadalambda</name>
<email>lambadalambda@mastodon.social</email>
- <summary></summary>
+ <summary>a cool dude.</summary>
<link rel="alternate" type="text/html" href="https://mastodon.social/@lambadalambda"/>
<link rel="avatar" type="image/gif" media:width="120" media:height="120" href="https://files.mastodon.social/accounts/avatars/000/000/264/original/1429214160519.gif?1492379244"/>
<link rel="header" type="" media:width="700" media:height="335" href="/headers/original/missing.png"/>
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs
index 6599b00b3..e40fae78c 100644
--- a/test/web/ostatus/ostatus_test.exs
+++ b/test/web/ostatus/ostatus_test.exs
@@ -233,6 +233,7 @@ defmodule Pleroma.Web.OStatusTest do
assert user.local == false
assert user.info["uri"] == uri
assert user.ap_id == uri
+ assert user.bio == "Call me Deacon Blues."
assert user.avatar["type"] == "Image"
{:ok, user_again} = OStatus.find_or_make_user(uri)
@@ -244,7 +245,9 @@ defmodule Pleroma.Web.OStatusTest do
uri = "https://social.heldscal.la/user/23211"
{:ok, user} = OStatus.find_or_make_user(uri)
- change = Ecto.Changeset.change(user, %{avatar: nil})
+ old_name = user.name
+ old_bio = user.bio
+ change = Ecto.Changeset.change(user, %{avatar: nil, bio: nil, old_name: nil})
{:ok, user} = Repo.update(change)
refute user.avatar
@@ -253,6 +256,8 @@ defmodule Pleroma.Web.OStatusTest do
[author] = :xmerl_xpath.string('//author[1]', doc)
{:ok, user} = OStatus.find_make_or_update_user(author)
assert user.avatar["type"] == "Image"
+ assert user.name == old_name
+ assert user.bio == old_bio
{:ok, user_again} = OStatus.find_make_or_update_user(author)
assert user_again == user
@@ -277,6 +282,7 @@ defmodule Pleroma.Web.OStatusTest do
"uri" => "https://social.heldscal.la/user/29191",
"host" => "social.heldscal.la",
"fqn" => user,
+ "bio" => "cofe",
"avatar" => %{"type" => "Image", "url" => [%{"href" => "https://social.heldscal.la/avatar/29191-original-20170421154949.jpeg", "mediaType" => "image/jpeg", "type" => "Link"}]}
}
assert data == expected
@@ -299,6 +305,7 @@ defmodule Pleroma.Web.OStatusTest do
"uri" => "https://social.heldscal.la/user/29191",
"host" => "social.heldscal.la",
"fqn" => user,
+ "bio" => "cofe",
"avatar" => %{"type" => "Image", "url" => [%{"href" => "https://social.heldscal.la/avatar/29191-original-20170421154949.jpeg", "mediaType" => "image/jpeg", "type" => "Link"}]}
}
assert data == expected
diff --git a/test/web/websub/websub_test.exs b/test/web/websub/websub_test.exs
index aaed9226e..1ca573d66 100644
--- a/test/web/websub/websub_test.exs
+++ b/test/web/websub/websub_test.exs
@@ -120,6 +120,7 @@ defmodule Pleroma.Web.WebsubTest do
"nickname" => "lambadalambda",
"name" => "Critical Value",
"host" => "mastodon.social",
+ "bio" => "a cool dude.",
"avatar" => %{"type" => "Image", "url" => [%{"href" => "https://files.mastodon.social/accounts/avatars/000/000/264/original/1429214160519.gif?1492379244", "mediaType" => "image/gif", "type" => "Link"}]}
}