projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Consistent style
[akkoma]
/
test
/
pleroma
/
web
/
streamer_test.exs
diff --git
a/test/pleroma/web/streamer_test.exs
b/test/pleroma/web/streamer_test.exs
index 3229ba6f9c90d0990a037d72d32de01668960f6d..764b799bbea215e3cc0f2ceac5e293412d7de82e 100644
(file)
--- a/
test/pleroma/web/streamer_test.exs
+++ b/
test/pleroma/web/streamer_test.exs
@@
-266,7
+266,7
@@
defmodule Pleroma.Web.StreamerTest do
{:ok, create_activity} =
CommonAPI.post_chat_message(other_user, user, "hey cirno", idempotency_key: "123")
{:ok, create_activity} =
CommonAPI.post_chat_message(other_user, user, "hey cirno", idempotency_key: "123")
- object = Object.normalize(create_activity, false)
+ object = Object.normalize(create_activity, f
etch: f
alse)
chat = Chat.get(user.id, other_user.ap_id)
cm_ref = MessageReference.for_chat_and_object(chat, object)
cm_ref = %{cm_ref | chat: chat, object: object}
chat = Chat.get(user.id, other_user.ap_id)
cm_ref = MessageReference.for_chat_and_object(chat, object)
cm_ref = %{cm_ref | chat: chat, object: object}
@@
-284,7
+284,7
@@
defmodule Pleroma.Web.StreamerTest do
other_user = insert(:user)
{:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey cirno")
other_user = insert(:user)
{:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey cirno")
- object = Object.normalize(create_activity, false)
+ object = Object.normalize(create_activity, f
etch: f
alse)
chat = Chat.get(user.id, other_user.ap_id)
cm_ref = MessageReference.for_chat_and_object(chat, object)
cm_ref = %{cm_ref | chat: chat, object: object}
chat = Chat.get(user.id, other_user.ap_id)
cm_ref = MessageReference.for_chat_and_object(chat, object)
cm_ref = %{cm_ref | chat: chat, object: object}
@@
-404,15
+404,14
@@
defmodule Pleroma.Web.StreamerTest do
refute Streamer.filtered_by_user?(user, notif)
end
refute Streamer.filtered_by_user?(user, notif)
end
- test "it sends relationships updates to the 'user' stream", %{
+ test "it sends
follow
relationships updates to the 'user' stream", %{
user: user,
token: oauth_token
} do
user_id = user.id
user_url = user.ap_id
user: user,
token: oauth_token
} do
user_id = user.id
user_url = user.ap_id
- follower = insert(:user)
- follower_token = insert(:oauth_token, user: follower)
- follower_id = follower.id
+ other_user = insert(:user)
+ other_user_id = other_user.id
body =
File.read!("test/fixtures/users_mock/localhost.json")
body =
File.read!("test/fixtures/users_mock/localhost.json")
@@
-425,47
+424,42
@@
defmodule Pleroma.Web.StreamerTest do
end)
Streamer.get_topic_and_add_socket("user", user, oauth_token)
end)
Streamer.get_topic_and_add_socket("user", user, oauth_token)
- Streamer.get_topic_and_add_socket("user", follower, follower_token)
- {:ok, _follower, _followed, _follow_activity} = CommonAPI.follow(follower, user)
+ {:ok, _follower, _followed, _follow_activity} = CommonAPI.follow(user, other_user)
- # follow_pending event sent to both follower and following
assert_receive {:text, event}
assert_receive {:text, event}
- assert_receive {:text, ^event}
- assert %{"event" => "pleroma:relationships_update", "payload" => payload} =
+ assert %{"event" => "pleroma:
follow_
relationships_update", "payload" => payload} =
Jason.decode!(event)
assert %{
"follower" => %{
"follower_count" => 0,
"following_count" => 0,
Jason.decode!(event)
assert %{
"follower" => %{
"follower_count" => 0,
"following_count" => 0,
- "id" => ^
follow
er_id
+ "id" => ^
us
er_id
},
"following" => %{
"follower_count" => 0,
"following_count" => 0,
},
"following" => %{
"follower_count" => 0,
"following_count" => 0,
- "id" => ^user_id
+ "id" => ^
other_
user_id
},
"state" => "follow_pending"
} = Jason.decode!(payload)
},
"state" => "follow_pending"
} = Jason.decode!(payload)
- # follow_accept event sent to both follower and following
assert_receive {:text, event}
assert_receive {:text, event}
- assert_receive {:text, ^event}
- assert %{"event" => "pleroma:relationships_update", "payload" => payload} =
+ assert %{"event" => "pleroma:
follow_
relationships_update", "payload" => payload} =
Jason.decode!(event)
assert %{
"follower" => %{
"follower_count" => 0,
"following_count" => 1,
Jason.decode!(event)
assert %{
"follower" => %{
"follower_count" => 0,
"following_count" => 1,
- "id" => ^
follow
er_id
+ "id" => ^
us
er_id
},
"following" => %{
"follower_count" => 1,
"following_count" => 0,
},
"following" => %{
"follower_count" => 1,
"following_count" => 0,
- "id" => ^user_id
+ "id" => ^
other_
user_id
},
"state" => "follow_accept"
} = Jason.decode!(payload)
},
"state" => "follow_accept"
} = Jason.decode!(payload)