1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Upload.Filter.MogrifyTest do
9 alias Pleroma.Upload.Filter
11 test "apply mogrify filter" do
12 clear_config(Filter.Mogrify, args: [{"tint", "40"}])
15 "test/fixtures/image.jpg",
16 "test/fixtures/image_tmp.jpg"
19 upload = %Pleroma.Upload{
20 name: "an… image.jpg",
21 content_type: "image/jpeg",
22 path: Path.absname("test/fixtures/image_tmp.jpg"),
23 tempfile: Path.absname("test/fixtures/image_tmp.jpg")
28 assert_receive {:apply_filter, {_, "tint", "40"}}, 4_000
32 open: fn _f -> %Mogrify.Image{} end,
33 custom: fn _m, _a -> :ok end,
34 custom: fn m, a, o -> send(task.pid, {:apply_filter, {m, a, o}}) end,
35 save: fn _f, _o -> :ok end do
36 assert Filter.Mogrify.filter(upload) == {:ok, :filtered}