aboutsummaryrefslogtreecommitdiff
path: root/test/pleroma/integration/mastodon_websocket_test.exs
diff options
context:
space:
mode:
authortusooa <tusooa@kazv.moe>2022-10-09 04:29:09 +0000
committertusooa <tusooa@kazv.moe>2022-10-09 04:29:09 +0000
commit8042e0ebe1277519d446a7e2fbcf17629c1ffab2 (patch)
tree91cd50d4adbfd12cb258d517f58fd3a9ee269fcf /test/pleroma/integration/mastodon_websocket_test.exs
parent3f1c31b7cd07a4d07e3ec407534c80a14f02294a (diff)
parentdd82fd234fcc322e0016d256662b7ad2e21e9834 (diff)
downloadpleroma-8042e0ebe1277519d446a7e2fbcf17629c1ffab2.tar.gz
Merge branch 'mergeback/2.4.4' into 'develop'
mergeback: 2.4.4 See merge request pleroma/pleroma!3762
Diffstat (limited to 'test/pleroma/integration/mastodon_websocket_test.exs')
-rw-r--r--test/pleroma/integration/mastodon_websocket_test.exs18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/pleroma/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs
index 0226b2a5d..9be0445c0 100644
--- a/test/pleroma/integration/mastodon_websocket_test.exs
+++ b/test/pleroma/integration/mastodon_websocket_test.exs
@@ -93,7 +93,7 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
{:ok, token} = OAuth.Token.exchange_token(app, auth)
- %{user: user, token: token}
+ %{app: app, user: user, token: token}
end
test "accepts valid tokens", state do
@@ -130,5 +130,21 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
Process.sleep(30)
end)
end
+
+ test "disconnect when token is revoked", %{app: app, user: user, token: token} do
+ assert {:ok, _} = start_socket("?stream=user:notification&access_token=#{token.token}")
+ assert {:ok, _} = start_socket("?stream=user&access_token=#{token.token}")
+
+ {:ok, auth} = OAuth.Authorization.create_authorization(app, user)
+
+ {:ok, token2} = OAuth.Token.exchange_token(app, auth)
+ assert {:ok, _} = start_socket("?stream=user&access_token=#{token2.token}")
+
+ OAuth.Token.Strategy.Revoke.revoke(token)
+
+ assert_receive {:close, _}
+ assert_receive {:close, _}
+ refute_receive {:close, _}
+ end
end
end