diff options
| author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-10-13 17:10:34 +0300 |
|---|---|---|
| committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-10-13 17:10:34 +0300 |
| commit | 4c4ea9a3486f824cfba825a176439d50ec54fe95 (patch) | |
| tree | 992e96bbdf4b40a5738ca2306ba3acf4158b17d5 /test/emoji | |
| parent | 3cb9c88837f3105363c5a615724b6363ee926d35 (diff) | |
| download | pleroma-4c4ea9a3486f824cfba825a176439d50ec54fe95.tar.gz pleroma-4c4ea9a3486f824cfba825a176439d50ec54fe95.zip | |
changes after rebase
Diffstat (limited to 'test/emoji')
| -rw-r--r-- | test/emoji/pack_test.exs | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/test/emoji/pack_test.exs b/test/emoji/pack_test.exs deleted file mode 100644 index 70d1eaa1b..000000000 --- a/test/emoji/pack_test.exs +++ /dev/null @@ -1,93 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Emoji.PackTest do - use ExUnit.Case, async: true - alias Pleroma.Emoji.Pack - - @emoji_path Path.join( - Pleroma.Config.get!([:instance, :static_dir]), - "emoji" - ) - - setup do - pack_path = Path.join(@emoji_path, "dump_pack") - File.mkdir(pack_path) - - File.write!(Path.join(pack_path, "pack.json"), """ - { - "files": { }, - "pack": { - "description": "Dump pack", "homepage": "https://pleroma.social", - "license": "Test license", "share-files": true - }} - """) - - {:ok, pack} = Pleroma.Emoji.Pack.load_pack("dump_pack") - - on_exit(fn -> - File.rm_rf!(pack_path) - end) - - {:ok, pack: pack} - end - - describe "add_file/4" do - test "add emojies from zip file", %{pack: pack} do - file = %Plug.Upload{ - content_type: "application/zip", - filename: "emojis.zip", - path: Path.absname("test/fixtures/emojis.zip") - } - - {:ok, updated_pack} = Pack.add_file(pack, nil, nil, file) - - assert updated_pack.files == %{ - "a_trusted_friend-128" => "128px/a_trusted_friend-128.png", - "auroraborealis" => "auroraborealis.png", - "baby_in_a_box" => "1000px/baby_in_a_box.png", - "bear" => "1000px/bear.png", - "bear-128" => "128px/bear-128.png" - } - - assert updated_pack.files_count == 5 - end - end - - test "returns error when zip file is bad", %{pack: pack} do - file = %Plug.Upload{ - content_type: "application/zip", - filename: "emojis.zip", - path: Path.absname("test/instance_static/emoji/test_pack/blank.png") - } - - assert Pack.add_file(pack, nil, nil, file) == {:error, :einval} - end - - test "returns pack when zip file is empty", %{pack: pack} do - file = %Plug.Upload{ - content_type: "application/zip", - filename: "emojis.zip", - path: Path.absname("test/fixtures/empty.zip") - } - - {:ok, updated_pack} = Pack.add_file(pack, nil, nil, file) - assert updated_pack == pack - end - - test "add emoji file", %{pack: pack} do - file = %Plug.Upload{ - filename: "blank.png", - path: "#{@emoji_path}/test_pack/blank.png" - } - - {:ok, updated_pack} = Pack.add_file(pack, "test_blank", "test_blank.png", file) - - assert updated_pack.files == %{ - "test_blank" => "test_blank.png" - } - - assert updated_pack.files_count == 1 - end -end |
