aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-04-26 18:33:10 +0200
committerRoger Braun <roger@rogerbraun.net>2017-04-26 18:33:10 +0200
commitc5fa682c317717c64168bf2d77b28d805ffff450 (patch)
tree354205bda2746296d2ca23a8f28f1a406582cf9d /test
parent57bd59e4071adf847f94229479e5ffa0951721fd (diff)
downloadpleroma-c5fa682c317717c64168bf2d77b28d805ffff450.tar.gz
Refactor, add beginnings of websub client subscriptions.
Diffstat (limited to 'test')
-rw-r--r--test/web/websub/websub_test.exs12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/web/websub/websub_test.exs b/test/web/websub/websub_test.exs
index 334ba03fc..7b77e696b 100644
--- a/test/web/websub/websub_test.exs
+++ b/test/web/websub/websub_test.exs
@@ -58,7 +58,6 @@ defmodule Pleroma.Web.WebsubTest do
"hub.lease_seconds" => "100"
}
-
{:ok, subscription } = Websub.incoming_subscription_request(user, data)
assert subscription.topic == Pleroma.Web.OStatus.feed_path(user)
assert subscription.state == "requested"
@@ -87,4 +86,15 @@ defmodule Pleroma.Web.WebsubTest do
assert length(Repo.all(WebsubServerSubscription)) == 1
assert subscription.id == sub.id
end
+
+ test "initiate a subscription for a given user and topic" do
+ user = insert(:user)
+ topic = "http://example.org/some-topic.atom"
+
+ {:ok, websub} = Websub.subscribe(user, topic)
+ assert websub.subscribers == [user.ap_id]
+ assert websub.topic == topic
+ assert is_binary(websub.secret)
+ assert websub.state == "accepted"
+ end
end