1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do
6 use Pleroma.Web.ConnCase
11 @emoji_path Path.join(
12 Pleroma.Config.get!([:instance, :static_dir]),
15 setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage], false)
18 admin = insert(:user, is_admin: true)
19 token = insert(:oauth_admin_token, user: admin)
23 |> assign(:user, admin)
24 |> assign(:token, token)
26 Pleroma.Emoji.reload()
27 {:ok, %{admin_conn: admin_conn}}
30 test "GET /api/pleroma/emoji/packs", %{conn: conn} do
31 resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
33 shared = resp["test_pack"]
34 assert shared["files"] == %{"blank" => "blank.png", "blank2" => "blank2.png"}
35 assert Map.has_key?(shared["pack"], "download-sha256")
36 assert shared["pack"]["can-download"]
37 assert shared["pack"]["share-files"]
39 non_shared = resp["test_pack_nonshared"]
40 assert non_shared["pack"]["share-files"] == false
41 assert non_shared["pack"]["can-download"] == false
45 |> get("/api/pleroma/emoji/packs?page_size=1")
46 |> json_response_and_validate_schema(200)
48 [pack1] = Map.keys(resp)
52 |> get("/api/pleroma/emoji/packs?page_size=1&page=2")
53 |> json_response_and_validate_schema(200)
55 [pack2] = Map.keys(resp)
59 |> get("/api/pleroma/emoji/packs?page_size=1&page=3")
60 |> json_response_and_validate_schema(200)
62 [pack3] = Map.keys(resp)
63 assert [pack1, pack2, pack3] |> Enum.uniq() |> length() == 3
66 describe "GET /api/pleroma/emoji/packs/remote" do
67 test "shareable instance", %{admin_conn: admin_conn, conn: conn} do
70 |> get("/api/pleroma/emoji/packs")
71 |> json_response_and_validate_schema(200)
74 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
75 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
77 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
78 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
80 %{method: :get, url: "https://example.com/api/pleroma/emoji/packs"} ->
85 |> get("/api/pleroma/emoji/packs/remote?url=https://example.com")
86 |> json_response_and_validate_schema(200) == resp
89 test "non shareable instance", %{admin_conn: admin_conn} do
91 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
92 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
94 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
95 json(%{metadata: %{features: []}})
99 |> get("/api/pleroma/emoji/packs/remote?url=https://example.com")
100 |> json_response_and_validate_schema(500) == %{
101 "error" => "The requested instance does not support sharing emoji packs"
106 describe "GET /api/pleroma/emoji/packs/:name/archive" do
107 test "download shared pack", %{conn: conn} do
110 |> get("/api/pleroma/emoji/packs/test_pack/archive")
113 {:ok, arch} = :zip.unzip(resp, [:memory])
115 assert Enum.find(arch, fn {n, _} -> n == 'pack.json' end)
116 assert Enum.find(arch, fn {n, _} -> n == 'blank.png' end)
119 test "non existing pack", %{conn: conn} do
121 |> get("/api/pleroma/emoji/packs/test_pack_for_import/archive")
122 |> json_response_and_validate_schema(:not_found) == %{
123 "error" => "Pack test_pack_for_import does not exist"
127 test "non downloadable pack", %{conn: conn} do
129 |> get("/api/pleroma/emoji/packs/test_pack_nonshared/archive")
130 |> json_response_and_validate_schema(:forbidden) == %{
132 "Pack test_pack_nonshared cannot be downloaded from this instance, either pack sharing was disabled for this pack or some files are missing"
137 describe "POST /api/pleroma/emoji/packs/download" do
138 test "shared pack from remote and non shared from fallback-src", %{
139 admin_conn: admin_conn,
143 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
144 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
146 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
147 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
151 url: "https://example.com/api/pleroma/emoji/packs/test_pack"
154 |> get("/api/pleroma/emoji/packs/test_pack")
155 |> json_response_and_validate_schema(200)
160 url: "https://example.com/api/pleroma/emoji/packs/test_pack/archive"
163 |> get("/api/pleroma/emoji/packs/test_pack/archive")
169 url: "https://example.com/api/pleroma/emoji/packs/test_pack_nonshared"
172 |> get("/api/pleroma/emoji/packs/test_pack_nonshared")
173 |> json_response_and_validate_schema(200)
178 url: "https://nonshared-pack"
180 text(File.read!("#{@emoji_path}/test_pack_nonshared/nonshared.zip"))
184 |> put_req_header("content-type", "multipart/form-data")
185 |> post("/api/pleroma/emoji/packs/download", %{
186 url: "https://example.com",
190 |> json_response_and_validate_schema(200) == "ok"
192 assert File.exists?("#{@emoji_path}/test_pack2/pack.json")
193 assert File.exists?("#{@emoji_path}/test_pack2/blank.png")
196 |> delete("/api/pleroma/emoji/packs/test_pack2")
197 |> json_response_and_validate_schema(200) == "ok"
199 refute File.exists?("#{@emoji_path}/test_pack2")
202 |> put_req_header("content-type", "multipart/form-data")
204 "/api/pleroma/emoji/packs/download",
206 url: "https://example.com",
207 name: "test_pack_nonshared",
208 as: "test_pack_nonshared2"
211 |> json_response_and_validate_schema(200) == "ok"
213 assert File.exists?("#{@emoji_path}/test_pack_nonshared2/pack.json")
214 assert File.exists?("#{@emoji_path}/test_pack_nonshared2/blank.png")
217 |> delete("/api/pleroma/emoji/packs/test_pack_nonshared2")
218 |> json_response_and_validate_schema(200) == "ok"
220 refute File.exists?("#{@emoji_path}/test_pack_nonshared2")
223 test "nonshareable instance", %{admin_conn: admin_conn} do
225 %{method: :get, url: "https://old-instance/.well-known/nodeinfo"} ->
226 json(%{links: [%{href: "https://old-instance/nodeinfo/2.1.json"}]})
228 %{method: :get, url: "https://old-instance/nodeinfo/2.1.json"} ->
229 json(%{metadata: %{features: []}})
233 |> put_req_header("content-type", "multipart/form-data")
235 "/api/pleroma/emoji/packs/download",
237 url: "https://old-instance",
242 |> json_response_and_validate_schema(500) == %{
243 "error" => "The requested instance does not support sharing emoji packs"
247 test "checksum fail", %{admin_conn: admin_conn} do
249 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
250 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
252 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
253 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
257 url: "https://example.com/api/pleroma/emoji/packs/pack_bad_sha"
259 {:ok, pack} = Pleroma.Emoji.Pack.load_pack("pack_bad_sha")
260 %Tesla.Env{status: 200, body: Jason.encode!(pack)}
264 url: "https://example.com/api/pleroma/emoji/packs/pack_bad_sha/archive"
268 body: File.read!("test/instance_static/emoji/pack_bad_sha/pack_bad_sha.zip")
273 |> put_req_header("content-type", "multipart/form-data")
274 |> post("/api/pleroma/emoji/packs/download", %{
275 url: "https://example.com",
276 name: "pack_bad_sha",
279 |> json_response_and_validate_schema(:internal_server_error) == %{
280 "error" => "SHA256 for the pack doesn't match the one sent by the server"
284 test "other error", %{admin_conn: admin_conn} do
286 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
287 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
289 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
290 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
294 url: "https://example.com/api/pleroma/emoji/packs/test_pack"
296 {:ok, pack} = Pleroma.Emoji.Pack.load_pack("test_pack")
297 %Tesla.Env{status: 200, body: Jason.encode!(pack)}
301 |> put_req_header("content-type", "multipart/form-data")
302 |> post("/api/pleroma/emoji/packs/download", %{
303 url: "https://example.com",
307 |> json_response_and_validate_schema(:internal_server_error) == %{
309 "The pack was not set as shared and there is no fallback src to download from"
314 describe "PATCH /api/pleroma/emoji/packs/:name" do
316 pack_file = "#{@emoji_path}/test_pack/pack.json"
317 original_content = File.read!(pack_file)
320 File.write!(pack_file, original_content)
324 pack_file: pack_file,
326 "license" => "Test license changed",
327 "homepage" => "https://pleroma.social",
328 "description" => "Test description",
329 "share-files" => false
333 test "for a pack without a fallback source", ctx do
334 assert ctx[:admin_conn]
335 |> put_req_header("content-type", "multipart/form-data")
336 |> patch("/api/pleroma/emoji/packs/test_pack", %{"metadata" => ctx[:new_data]})
337 |> json_response_and_validate_schema(200) == ctx[:new_data]
339 assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == ctx[:new_data]
342 test "for a pack with a fallback source", ctx do
346 url: "https://nonshared-pack"
348 text(File.read!("#{@emoji_path}/test_pack_nonshared/nonshared.zip"))
351 new_data = Map.put(ctx[:new_data], "fallback-src", "https://nonshared-pack")
356 "fallback-src-sha256",
357 "1967BB4E42BCC34BCC12D57BE7811D3B7BE52F965BCE45C87BD377B9499CE11D"
360 assert ctx[:admin_conn]
361 |> put_req_header("content-type", "multipart/form-data")
362 |> patch("/api/pleroma/emoji/packs/test_pack", %{metadata: new_data})
363 |> json_response_and_validate_schema(200) == new_data_with_sha
365 assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == new_data_with_sha
368 test "when the fallback source doesn't have all the files", ctx do
372 url: "https://nonshared-pack"
374 {:ok, {'empty.zip', empty_arch}} = :zip.zip('empty.zip', [], [:memory])
378 new_data = Map.put(ctx[:new_data], "fallback-src", "https://nonshared-pack")
380 assert ctx[:admin_conn]
381 |> put_req_header("content-type", "multipart/form-data")
382 |> patch("/api/pleroma/emoji/packs/test_pack", %{metadata: new_data})
383 |> json_response_and_validate_schema(:bad_request) == %{
384 "error" => "The fallback archive does not have all files specified in pack.json"
389 describe "POST/PATCH/DELETE /api/pleroma/emoji/packs/:name/files" do
391 pack_file = "#{@emoji_path}/test_pack/pack.json"
392 original_content = File.read!(pack_file)
395 File.write!(pack_file, original_content)
401 test "create shortcode exists", %{admin_conn: admin_conn} do
403 |> put_req_header("content-type", "multipart/form-data")
404 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
406 filename: "dir/blank.png",
408 filename: "blank.png",
409 path: "#{@emoji_path}/test_pack/blank.png"
412 |> json_response_and_validate_schema(:conflict) == %{
413 "error" => "An emoji with the \"blank\" shortcode already exists"
417 test "don't rewrite old emoji", %{admin_conn: admin_conn} do
418 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/dir/") end)
421 |> put_req_header("content-type", "multipart/form-data")
422 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
424 filename: "dir/blank.png",
426 filename: "blank.png",
427 path: "#{@emoji_path}/test_pack/blank.png"
430 |> json_response_and_validate_schema(200) == %{
431 "blank" => "blank.png",
432 "blank2" => "blank2.png",
433 "blank3" => "dir/blank.png"
436 assert File.exists?("#{@emoji_path}/test_pack/dir/blank.png")
439 |> put_req_header("content-type", "multipart/form-data")
440 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
442 new_shortcode: "blank2",
443 new_filename: "dir_2/blank_3.png"
445 |> json_response_and_validate_schema(:conflict) == %{
447 "New shortcode \"blank2\" is already used. If you want to override emoji use 'force' option"
451 test "rewrite old emoji with force option", %{admin_conn: admin_conn} do
452 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/dir_2/") end)
455 |> put_req_header("content-type", "multipart/form-data")
456 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
458 filename: "dir/blank.png",
460 filename: "blank.png",
461 path: "#{@emoji_path}/test_pack/blank.png"
464 |> json_response_and_validate_schema(200) == %{
465 "blank" => "blank.png",
466 "blank2" => "blank2.png",
467 "blank3" => "dir/blank.png"
470 assert File.exists?("#{@emoji_path}/test_pack/dir/blank.png")
473 |> put_req_header("content-type", "multipart/form-data")
474 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
476 new_shortcode: "blank4",
477 new_filename: "dir_2/blank_3.png",
480 |> json_response_and_validate_schema(200) == %{
481 "blank" => "blank.png",
482 "blank2" => "blank2.png",
483 "blank4" => "dir_2/blank_3.png"
486 assert File.exists?("#{@emoji_path}/test_pack/dir_2/blank_3.png")
489 test "with empty filename", %{admin_conn: admin_conn} do
491 |> put_req_header("content-type", "multipart/form-data")
492 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
496 filename: "blank.png",
497 path: "#{@emoji_path}/test_pack/blank.png"
500 |> json_response_and_validate_schema(:bad_request) == %{
501 "error" => "pack name, shortcode or filename cannot be empty"
505 test "add file with not loaded pack", %{admin_conn: admin_conn} do
507 |> put_req_header("content-type", "multipart/form-data")
508 |> post("/api/pleroma/emoji/packs/not_loaded/files", %{
510 filename: "dir/blank.png",
512 filename: "blank.png",
513 path: "#{@emoji_path}/test_pack/blank.png"
516 |> json_response_and_validate_schema(:bad_request) == %{
517 "error" => "pack \"not_loaded\" is not found"
521 test "remove file with not loaded pack", %{admin_conn: admin_conn} do
523 |> delete("/api/pleroma/emoji/packs/not_loaded/files?shortcode=blank3")
524 |> json_response_and_validate_schema(:bad_request) == %{
525 "error" => "pack \"not_loaded\" is not found"
529 test "remove file with empty shortcode", %{admin_conn: admin_conn} do
531 |> delete("/api/pleroma/emoji/packs/not_loaded/files?shortcode=")
532 |> json_response_and_validate_schema(:bad_request) == %{
533 "error" => "pack name or shortcode cannot be empty"
537 test "update file with not loaded pack", %{admin_conn: admin_conn} do
539 |> put_req_header("content-type", "multipart/form-data")
540 |> patch("/api/pleroma/emoji/packs/not_loaded/files", %{
542 new_shortcode: "blank3",
543 new_filename: "dir_2/blank_3.png"
545 |> json_response_and_validate_schema(:bad_request) == %{
546 "error" => "pack \"not_loaded\" is not found"
550 test "new with shortcode as file with update", %{admin_conn: admin_conn} do
552 |> put_req_header("content-type", "multipart/form-data")
553 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
555 filename: "dir/blank.png",
557 filename: "blank.png",
558 path: "#{@emoji_path}/test_pack/blank.png"
561 |> json_response_and_validate_schema(200) == %{
562 "blank" => "blank.png",
563 "blank4" => "dir/blank.png",
564 "blank2" => "blank2.png"
567 assert File.exists?("#{@emoji_path}/test_pack/dir/blank.png")
570 |> put_req_header("content-type", "multipart/form-data")
571 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
573 new_shortcode: "blank3",
574 new_filename: "dir_2/blank_3.png"
576 |> json_response_and_validate_schema(200) == %{
577 "blank3" => "dir_2/blank_3.png",
578 "blank" => "blank.png",
579 "blank2" => "blank2.png"
582 refute File.exists?("#{@emoji_path}/test_pack/dir/")
583 assert File.exists?("#{@emoji_path}/test_pack/dir_2/blank_3.png")
586 |> delete("/api/pleroma/emoji/packs/test_pack/files?shortcode=blank3")
587 |> json_response_and_validate_schema(200) == %{
588 "blank" => "blank.png",
589 "blank2" => "blank2.png"
592 refute File.exists?("#{@emoji_path}/test_pack/dir_2/")
594 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/dir") end)
597 test "new with shortcode from url", %{admin_conn: admin_conn} do
601 url: "https://test-blank/blank_url.png"
603 text(File.read!("#{@emoji_path}/test_pack/blank.png"))
607 |> put_req_header("content-type", "multipart/form-data")
608 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
609 shortcode: "blank_url",
610 file: "https://test-blank/blank_url.png"
612 |> json_response_and_validate_schema(200) == %{
613 "blank_url" => "blank_url.png",
614 "blank" => "blank.png",
615 "blank2" => "blank2.png"
618 assert File.exists?("#{@emoji_path}/test_pack/blank_url.png")
620 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/blank_url.png") end)
623 test "new without shortcode", %{admin_conn: admin_conn} do
624 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/shortcode.png") end)
627 |> put_req_header("content-type", "multipart/form-data")
628 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
630 filename: "shortcode.png",
631 path: "#{Pleroma.Config.get([:instance, :static_dir])}/add/shortcode.png"
634 |> json_response_and_validate_schema(200) == %{
635 "shortcode" => "shortcode.png",
636 "blank" => "blank.png",
637 "blank2" => "blank2.png"
641 test "remove non existing shortcode in pack.json", %{admin_conn: admin_conn} do
643 |> delete("/api/pleroma/emoji/packs/test_pack/files?shortcode=blank3")
644 |> json_response_and_validate_schema(:bad_request) == %{
645 "error" => "Emoji \"blank3\" does not exist"
649 test "update non existing emoji", %{admin_conn: admin_conn} do
651 |> put_req_header("content-type", "multipart/form-data")
652 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
654 new_shortcode: "blank4",
655 new_filename: "dir_2/blank_3.png"
657 |> json_response_and_validate_schema(:bad_request) == %{
658 "error" => "Emoji \"blank3\" does not exist"
662 test "update with empty shortcode", %{admin_conn: admin_conn} do
664 "error" => "Missing field: new_shortcode."
667 |> put_req_header("content-type", "multipart/form-data")
668 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
670 new_filename: "dir_2/blank_3.png"
672 |> json_response_and_validate_schema(:bad_request)
676 describe "POST/DELETE /api/pleroma/emoji/packs/:name" do
677 test "creating and deleting a pack", %{admin_conn: admin_conn} do
679 |> post("/api/pleroma/emoji/packs/test_created")
680 |> json_response_and_validate_schema(200) == "ok"
682 assert File.exists?("#{@emoji_path}/test_created/pack.json")
684 assert Jason.decode!(File.read!("#{@emoji_path}/test_created/pack.json")) == %{
690 |> delete("/api/pleroma/emoji/packs/test_created")
691 |> json_response_and_validate_schema(200) == "ok"
693 refute File.exists?("#{@emoji_path}/test_created/pack.json")
696 test "if pack exists", %{admin_conn: admin_conn} do
697 path = Path.join(@emoji_path, "test_created")
699 pack_file = Jason.encode!(%{files: %{}, pack: %{}})
700 File.write!(Path.join(path, "pack.json"), pack_file)
703 |> post("/api/pleroma/emoji/packs/test_created")
704 |> json_response_and_validate_schema(:conflict) == %{
705 "error" => "A pack named \"test_created\" already exists"
708 on_exit(fn -> File.rm_rf(path) end)
711 test "with empty name", %{admin_conn: admin_conn} do
713 |> post("/api/pleroma/emoji/packs/ ")
714 |> json_response_and_validate_schema(:bad_request) == %{
715 "error" => "pack name cannot be empty"
720 test "deleting nonexisting pack", %{admin_conn: admin_conn} do
722 |> delete("/api/pleroma/emoji/packs/non_existing")
723 |> json_response_and_validate_schema(:not_found) == %{
724 "error" => "Pack non_existing does not exist"
728 test "deleting with empty name", %{admin_conn: admin_conn} do
730 |> delete("/api/pleroma/emoji/packs/ ")
731 |> json_response_and_validate_schema(:bad_request) == %{
732 "error" => "pack name cannot be empty"
736 test "filesystem import", %{admin_conn: admin_conn, conn: conn} do
738 File.rm!("#{@emoji_path}/test_pack_for_import/emoji.txt")
739 File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
742 resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
744 refute Map.has_key?(resp, "test_pack_for_import")
747 |> get("/api/pleroma/emoji/packs/import")
748 |> json_response_and_validate_schema(200) == ["test_pack_for_import"]
750 resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
751 assert resp["test_pack_for_import"]["files"] == %{"blank" => "blank.png"}
753 File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
754 refute File.exists?("#{@emoji_path}/test_pack_for_import/pack.json")
756 emoji_txt_content = """
757 blank, blank.png, Fun
759 foo, /emoji/test_pack_for_import/blank.png
763 File.write!("#{@emoji_path}/test_pack_for_import/emoji.txt", emoji_txt_content)
766 |> get("/api/pleroma/emoji/packs/import")
767 |> json_response_and_validate_schema(200) == ["test_pack_for_import"]
769 resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
771 assert resp["test_pack_for_import"]["files"] == %{
772 "blank" => "blank.png",
773 "blank2" => "blank.png",
778 describe "GET /api/pleroma/emoji/packs/:name" do
779 test "shows pack.json", %{conn: conn} do
783 "can-download" => true,
784 "description" => "Test description",
785 "download-sha256" => _,
786 "homepage" => "https://pleroma.social",
787 "license" => "Test license",
788 "share-files" => true
792 |> get("/api/pleroma/emoji/packs/test_pack")
793 |> json_response_and_validate_schema(200)
795 assert files == %{"blank" => "blank.png", "blank2" => "blank2.png"}
801 |> get("/api/pleroma/emoji/packs/test_pack?page_size=1")
802 |> json_response_and_validate_schema(200)
804 assert files |> Map.keys() |> length() == 1
810 |> get("/api/pleroma/emoji/packs/test_pack?page_size=1&page=2")
811 |> json_response_and_validate_schema(200)
813 assert files |> Map.keys() |> length() == 1
816 test "non existing pack", %{conn: conn} do
818 |> get("/api/pleroma/emoji/packs/non_existing")
819 |> json_response_and_validate_schema(:not_found) == %{
820 "error" => "Pack non_existing does not exist"
824 test "error name", %{conn: conn} do
826 |> get("/api/pleroma/emoji/packs/ ")
827 |> json_response_and_validate_schema(:bad_request) == %{
828 "error" => "pack name cannot be empty"