Websub controller beginnings.
This commit is contained in:
parent
5e7ceeba94
commit
1b9cc721a0
7 changed files with 85 additions and 5 deletions
30
test/web/websub/websub_controller_test.exs
Normal file
30
test/web/websub/websub_controller_test.exs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
defmodule Pleroma.Web.Websub.WebsubControllerTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
import Pleroma.Factory
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.Web.Websub.WebsubServerSubscription
|
||||
|
||||
test "websub subscription request", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
path = Pleroma.Web.OStatus.pubsub_path(user)
|
||||
|
||||
data = %{
|
||||
"hub.callback": "http://example.org/sub",
|
||||
"hub.mode": "subscription",
|
||||
"hub.topic": Pleroma.Web.OStatus.feed_path(user),
|
||||
"hub.secret": "a random secret",
|
||||
"hub.lease_seconds": 100
|
||||
}
|
||||
|
||||
conn = conn
|
||||
|> post(path, data)
|
||||
|
||||
assert response(conn, 202) == "Accepted"
|
||||
subscription = Repo.one!(WebsubServerSubscription)
|
||||
assert subscription.topic == Pleroma.Web.OStatus.feed_path(user)
|
||||
assert subscription.state == "requested"
|
||||
assert subscription.secret == "a random secret"
|
||||
assert subscription.valid_until == NaiveDateTime.add(subscription.inserted_at, 100)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue