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
14 filter = Config.get([Filter.Mogrify, :args])
17 Config.put([Filter.Mogrify, :args], filter)
21 test "apply mogrify filter" do
22 Config.put([Filter.Mogrify, :args], [{"tint", "40"}])
25 "test/fixtures/image.jpg",
26 "test/fixtures/image_tmp.jpg"
30 name: "an… image.jpg",
31 content_type: "image/jpg",
32 path: Path.absname("test/fixtures/image_tmp.jpg"),
33 tempfile: Path.absname("test/fixtures/image_tmp.jpg")
38 assert_receive {:apply_filter, {_, "tint", "40"}}, 4_000
42 open: fn _f -> %Mogrify.Image{} end,
43 custom: fn _m, _a -> :ok end,
44 custom: fn m, a, o -> send(task.pid, {:apply_filter, {m, a, o}}) end,
45 save: fn _f, _o -> :ok end do
46 assert Filter.Mogrify.filter(upload) == :ok