Test Relay, switch to runtime configuration.

This commit is contained in:
lain 2018-09-08 14:02:38 +02:00 committed by William Pitcock
commit 1e9ced5af4
6 changed files with 99 additions and 8 deletions

View file

@ -4,6 +4,29 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
alias Pleroma.Web.ActivityPub.{UserView, ObjectView}
alias Pleroma.{Repo, User}
alias Pleroma.Activity
alias Pleroma.Config
describe "/relay" do
test "with the relay active, it returns the relay user", %{conn: conn} do
Config.put([:instance, :allow_relay], true)
res =
conn
|> get(activity_pub_path(conn, :relay))
|> json_response(200)
assert res["id"] =~ "/relay"
end
test "with the relay disabled, it returns 404", %{conn: conn} do
Config.put([:instance, :allow_relay], false)
res =
conn
|> get(activity_pub_path(conn, :relay))
|> json_response(404)
end
end
describe "/users/:nickname" do
test "it returns a json representation of the user", %{conn: conn} do

View file

@ -0,0 +1,11 @@
defmodule Pleroma.Web.ActivityPub.RelayTest do
use Pleroma.DataCase
alias Pleroma.Web.ActivityPub.Relay
test "gets an actor for the relay" do
user = Relay.get_actor()
assert user.ap_id =~ "/relay"
end
end