From 9e0e2fb6b44f37f0ca484e40208edd46cb0f3430 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 16 Feb 2021 09:32:03 -0600 Subject: Fix test name, credo --- test/pleroma/upload/filter/heic_to_jpeg_test.exs | 40 ------------------------ test/pleroma/upload/filter/heif_to_jpeg_test.exs | 40 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 test/pleroma/upload/filter/heic_to_jpeg_test.exs create mode 100644 test/pleroma/upload/filter/heif_to_jpeg_test.exs diff --git a/test/pleroma/upload/filter/heic_to_jpeg_test.exs b/test/pleroma/upload/filter/heic_to_jpeg_test.exs deleted file mode 100644 index 3a5d0a1c1..000000000 --- a/test/pleroma/upload/filter/heic_to_jpeg_test.exs +++ /dev/null @@ -1,40 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Upload.Filter.HeicToJpegTest do - use Pleroma.DataCase, async: true - alias Pleroma.Upload.Filter - - test "apply HeicToJpeg filter" do - assert Pleroma.Utils.command_available?("mogrify") - - File.cp!( - "test/fixtures/image.heic", - "test/fixtures/heictmp" - ) - - upload = %Pleroma.Upload{ - name: "image.heic", - content_type: "image/heic", - path: Path.absname("test/fixtures/image.heic"), - tempfile: Path.absname("test/fixtures/heictmp") - } - - {:ok, :filtered, result} = Filter.HeifToJpeg.filter(upload) - - assert result.content_type == "image/jpeg" - assert result.name == "image.jpg" - assert String.ends_with?(result.path, "jpg") - - assert {:ok, - %Majic.Result{ - content: - "JPEG image data, JFIF standard 1.02, resolution (DPI), density 96x96, segment length 16, progressive, precision 8, 1024x768, components 3", - encoding: "binary", - mime_type: "image/jpeg" - }} == Majic.perform(result.path, pool: Pleroma.MajicPool) - - on_exit(fn -> File.rm!("test/fixtures/heictmp") end) - end -end diff --git a/test/pleroma/upload/filter/heif_to_jpeg_test.exs b/test/pleroma/upload/filter/heif_to_jpeg_test.exs new file mode 100644 index 000000000..8d127bf76 --- /dev/null +++ b/test/pleroma/upload/filter/heif_to_jpeg_test.exs @@ -0,0 +1,40 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Upload.Filter.HeifToJpegTest do + use Pleroma.DataCase, async: true + alias Pleroma.Upload.Filter + + test "apply HeicToJpeg filter" do + assert Pleroma.Utils.command_available?("mogrify") + + File.cp!( + "test/fixtures/image.heic", + "test/fixtures/heictmp" + ) + + upload = %Pleroma.Upload{ + name: "image.heic", + content_type: "image/heic", + path: Path.absname("test/fixtures/image.heic"), + tempfile: Path.absname("test/fixtures/heictmp") + } + + {:ok, :filtered, result} = Filter.HeifToJpeg.filter(upload) + + assert result.content_type == "image/jpeg" + assert result.name == "image.jpg" + assert String.ends_with?(result.path, "jpg") + + assert {:ok, + %Majic.Result{ + content: + "JPEG image data, JFIF standard 1.02, resolution (DPI), density 96x96, segment length 16, progressive, precision 8, 1024x768, components 3", + encoding: "binary", + mime_type: "image/jpeg" + }} == Majic.perform(result.path, pool: Pleroma.MajicPool) + + on_exit(fn -> File.rm!("test/fixtures/heictmp") end) + end +end -- cgit v1.2.3