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.Upload.Filter.MogrifyTest do
11 alias Pleroma.Upload.Filter
13 clear_config([Filter.Mogrify, :args])
15 test "apply mogrify filter" do
16 Config.put([Filter.Mogrify, :args], [{"tint", "40"}])
19 "test/fixtures/image.jpg",
20 "test/fixtures/image_tmp.jpg"
24 name: "an… image.jpg",
25 content_type: "image/jpg",
26 path: Path.absname("test/fixtures/image_tmp.jpg"),
27 tempfile: Path.absname("test/fixtures/image_tmp.jpg")
32 assert_receive {:apply_filter, {_, "tint", "40"}}, 4_000
36 open: fn _f -> %Mogrify.Image{} end,
37 custom: fn _m, _a -> :ok end,
38 custom: fn m, a, o -> send(task.pid, {:apply_filter, {m, a, o}}) end,
39 save: fn _f, _o -> :ok end do
40 assert Filter.Mogrify.filter(upload) == :ok