allow users with admin:metrics to read app metrics
[akkoma] / test / support / conn_case.ex
index 953aa010abccb094762261c0fe7b8a118af7e5ec..eab46983391fb17415dbd82cfe1140f25541416e 100644 (file)
@@ -67,13 +67,11 @@ defmodule Pleroma.Web.ConnCase do
       end
 
       defp json_response_and_validate_schema(
-             %{
-               private: %{
-                 open_api_spex: %{operation_id: op_id, operation_lookup: lookup, spec: spec}
-               }
-             } = conn,
+             %{private: %{operation_id: op_id}} = conn,
              status
            ) do
+        {spec, lookup} = OpenApiSpex.Plug.PutApiSpec.get_spec_and_operation_lookup(conn)
+
         content_type =
           conn
           |> Plug.Conn.get_resp_header("content-type")
@@ -104,9 +102,7 @@ defmodule Pleroma.Web.ConnCase do
               end)
 
             flunk(
-              "Response does not conform to schema of #{op_id} operation: #{
-                Enum.join(errors, "\n")
-              }\n#{inspect(json)}"
+              "Response does not conform to schema of #{op_id} operation: #{Enum.join(errors, "\n")}\n#{inspect(json)}"
             )
         end
       end