Refactor, add beginnings of websub client subscriptions.
This commit is contained in:
parent
57bd59e407
commit
c5fa682c31
6 changed files with 93 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue