1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Tests.Helpers do
7 Helpers for use in tests.
10 defmacro __using__(_opts) do
12 def refresh_record(%{id: id, __struct__: model} = _),
13 do: refresh_record(model, %{id: id})
15 def refresh_record(model, %{id: id} = _) do
16 Pleroma.Repo.get_by(model, id: id)
19 # Used for comparing json rendering during tests.
20 def render_json(view, template, assigns) do
21 assigns = Map.new(assigns)
23 view.render(template, assigns)