1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Plugs.SetFormatPlugTest do
6 use ExUnit.Case, async: true
9 alias Pleroma.Plugs.SetFormatPlug
11 test "set format from params" do
14 |> conn("/cofe?_format=json")
15 |> SetFormatPlug.call([])
17 assert %{format: "json"} == conn.assigns
20 test "set format from header" do
24 |> put_private(:phoenix_format, "xml")
25 |> SetFormatPlug.call([])
27 assert %{format: "xml"} == conn.assigns
30 test "doesn't set format" do
34 |> SetFormatPlug.call([])
36 refute conn.assigns[:format]