akkoma/test/pleroma/web/opensearch_controller_test.exs

22 lines
762 B
Elixir

# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OpenSearchControllerTest do
use Pleroma.Web.ConnCase, async: false
alias Pleroma.Config
alias Pleroma.Web.Endpoint
test "opensearch.xml", %{conn: conn} do
resp =
conn
|> put_req_header("accept", "application/opensearchdescription+xml")
|> get("/opensearch.xml")
|> response(200)
assert resp =~ "<ShortName>#{Config.get([:instance, :name])}</ShortName>"
assert resp =~ "<Description>Search through #{Config.get([:instance, :name])}</Description>"
assert resp =~ "template=\"#{Endpoint.url()}/search?query={searchTerms}\""
end
end