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 assert resp["count"] == 3
39 shared = resp["packs"]["test_pack"]
40 assert shared["files"] == %{"blank" => "blank.png", "blank2" => "blank2.png"}
41 assert Map.has_key?(shared["pack"], "download-sha256")
42 assert shared["pack"]["can-download"]
43 assert shared["pack"]["share-files"]
45 non_shared = resp["packs"]["test_pack_nonshared"]
46 assert non_shared["pack"]["share-files"] == false
47 assert non_shared["pack"]["can-download"] == false
51 |> get("/api/pleroma/emoji/packs?page_size=1")
52 |> json_response_and_validate_schema(200)
54 assert resp["count"] == 3
56 packs = Map.keys(resp["packs"])
58 assert length(packs) == 1
64 |> get("/api/pleroma/emoji/packs?page_size=1&page=2")
65 |> json_response_and_validate_schema(200)
67 assert resp["count"] == 3
68 packs = Map.keys(resp["packs"])
69 assert length(packs) == 1
74 |> get("/api/pleroma/emoji/packs?page_size=1&page=3")
75 |> json_response_and_validate_schema(200)
77 assert resp["count"] == 3
78 packs = Map.keys(resp["packs"])
79 assert length(packs) == 1
81 assert [pack1, pack2, pack3] |> Enum.uniq() |> length() == 3
84 describe "GET /api/pleroma/emoji/packs/remote" do
85 test "shareable instance", %{admin_conn: admin_conn, conn: conn} do
88 |> get("/api/pleroma/emoji/packs")
89 |> json_response_and_validate_schema(200)
92 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
93 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
95 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
96 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
98 %{method: :get, url: "https://example.com/api/pleroma/emoji/packs"} ->
103 |> get("/api/pleroma/emoji/packs/remote?url=https://example.com")
104 |> json_response_and_validate_schema(200) == resp
107 test "non shareable instance", %{admin_conn: admin_conn} do
109 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
110 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
112 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
113 json(%{metadata: %{features: []}})
117 |> get("/api/pleroma/emoji/packs/remote?url=https://example.com")
118 |> json_response_and_validate_schema(500) == %{
119 "error" => "The requested instance does not support sharing emoji packs"
124 describe "GET /api/pleroma/emoji/packs/:name/archive" do
125 test "download shared pack", %{conn: conn} do
128 |> get("/api/pleroma/emoji/packs/test_pack/archive")
131 {:ok, arch} = :zip.unzip(resp, [:memory])
133 assert Enum.find(arch, fn {n, _} -> n == 'pack.json' end)
134 assert Enum.find(arch, fn {n, _} -> n == 'blank.png' end)
137 test "non existing pack", %{conn: conn} do
139 |> get("/api/pleroma/emoji/packs/test_pack_for_import/archive")
140 |> json_response_and_validate_schema(:not_found) == %{
141 "error" => "Pack test_pack_for_import does not exist"
145 test "non downloadable pack", %{conn: conn} do
147 |> get("/api/pleroma/emoji/packs/test_pack_nonshared/archive")
148 |> json_response_and_validate_schema(:forbidden) == %{
150 "Pack test_pack_nonshared cannot be downloaded from this instance, either pack sharing was disabled for this pack or some files are missing"
155 describe "POST /api/pleroma/emoji/packs/download" do
156 test "shared pack from remote and non shared from fallback-src", %{
157 admin_conn: admin_conn,
161 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
162 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
164 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
165 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
169 url: "https://example.com/api/pleroma/emoji/packs/test_pack"
172 |> get("/api/pleroma/emoji/packs/test_pack")
173 |> json_response_and_validate_schema(200)
178 url: "https://example.com/api/pleroma/emoji/packs/test_pack/archive"
181 |> get("/api/pleroma/emoji/packs/test_pack/archive")
187 url: "https://example.com/api/pleroma/emoji/packs/test_pack_nonshared"
190 |> get("/api/pleroma/emoji/packs/test_pack_nonshared")
191 |> json_response_and_validate_schema(200)
196 url: "https://nonshared-pack"
198 text(File.read!("#{@emoji_path}/test_pack_nonshared/nonshared.zip"))
202 |> put_req_header("content-type", "multipart/form-data")
203 |> post("/api/pleroma/emoji/packs/download", %{
204 url: "https://example.com",
208 |> json_response_and_validate_schema(200) == "ok"
210 assert File.exists?("#{@emoji_path}/test_pack2/pack.json")
211 assert File.exists?("#{@emoji_path}/test_pack2/blank.png")
214 |> delete("/api/pleroma/emoji/packs/test_pack2")
215 |> json_response_and_validate_schema(200) == "ok"
217 refute File.exists?("#{@emoji_path}/test_pack2")
220 |> put_req_header("content-type", "multipart/form-data")
222 "/api/pleroma/emoji/packs/download",
224 url: "https://example.com",
225 name: "test_pack_nonshared",
226 as: "test_pack_nonshared2"
229 |> json_response_and_validate_schema(200) == "ok"
231 assert File.exists?("#{@emoji_path}/test_pack_nonshared2/pack.json")
232 assert File.exists?("#{@emoji_path}/test_pack_nonshared2/blank.png")
235 |> delete("/api/pleroma/emoji/packs/test_pack_nonshared2")
236 |> json_response_and_validate_schema(200) == "ok"
238 refute File.exists?("#{@emoji_path}/test_pack_nonshared2")
241 test "nonshareable instance", %{admin_conn: admin_conn} do
243 %{method: :get, url: "https://old-instance/.well-known/nodeinfo"} ->
244 json(%{links: [%{href: "https://old-instance/nodeinfo/2.1.json"}]})
246 %{method: :get, url: "https://old-instance/nodeinfo/2.1.json"} ->
247 json(%{metadata: %{features: []}})
251 |> put_req_header("content-type", "multipart/form-data")
253 "/api/pleroma/emoji/packs/download",
255 url: "https://old-instance",
260 |> json_response_and_validate_schema(500) == %{
261 "error" => "The requested instance does not support sharing emoji packs"
265 test "checksum fail", %{admin_conn: admin_conn} do
267 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
268 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
270 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
271 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
275 url: "https://example.com/api/pleroma/emoji/packs/pack_bad_sha"
277 {:ok, pack} = Pleroma.Emoji.Pack.load_pack("pack_bad_sha")
278 %Tesla.Env{status: 200, body: Jason.encode!(pack)}
282 url: "https://example.com/api/pleroma/emoji/packs/pack_bad_sha/archive"
286 body: File.read!("test/instance_static/emoji/pack_bad_sha/pack_bad_sha.zip")
291 |> put_req_header("content-type", "multipart/form-data")
292 |> post("/api/pleroma/emoji/packs/download", %{
293 url: "https://example.com",
294 name: "pack_bad_sha",
297 |> json_response_and_validate_schema(:internal_server_error) == %{
298 "error" => "SHA256 for the pack doesn't match the one sent by the server"
302 test "other error", %{admin_conn: admin_conn} do
304 %{method: :get, url: "https://example.com/.well-known/nodeinfo"} ->
305 json(%{links: [%{href: "https://example.com/nodeinfo/2.1.json"}]})
307 %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
308 json(%{metadata: %{features: ["shareable_emoji_packs"]}})
312 url: "https://example.com/api/pleroma/emoji/packs/test_pack"
314 {:ok, pack} = Pleroma.Emoji.Pack.load_pack("test_pack")
315 %Tesla.Env{status: 200, body: Jason.encode!(pack)}
319 |> put_req_header("content-type", "multipart/form-data")
320 |> post("/api/pleroma/emoji/packs/download", %{
321 url: "https://example.com",
325 |> json_response_and_validate_schema(:internal_server_error) == %{
327 "The pack was not set as shared and there is no fallback src to download from"
332 describe "PATCH /api/pleroma/emoji/packs/:name" do
334 pack_file = "#{@emoji_path}/test_pack/pack.json"
335 original_content = File.read!(pack_file)
338 File.write!(pack_file, original_content)
342 pack_file: pack_file,
344 "license" => "Test license changed",
345 "homepage" => "https://pleroma.social",
346 "description" => "Test description",
347 "share-files" => false
351 test "for a pack without a fallback source", ctx do
352 assert ctx[:admin_conn]
353 |> put_req_header("content-type", "multipart/form-data")
354 |> patch("/api/pleroma/emoji/packs/test_pack", %{"metadata" => ctx[:new_data]})
355 |> json_response_and_validate_schema(200) == ctx[:new_data]
357 assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == ctx[:new_data]
360 test "for a pack with a fallback source", ctx do
364 url: "https://nonshared-pack"
366 text(File.read!("#{@emoji_path}/test_pack_nonshared/nonshared.zip"))
369 new_data = Map.put(ctx[:new_data], "fallback-src", "https://nonshared-pack")
374 "fallback-src-sha256",
375 "1967BB4E42BCC34BCC12D57BE7811D3B7BE52F965BCE45C87BD377B9499CE11D"
378 assert ctx[:admin_conn]
379 |> put_req_header("content-type", "multipart/form-data")
380 |> patch("/api/pleroma/emoji/packs/test_pack", %{metadata: new_data})
381 |> json_response_and_validate_schema(200) == new_data_with_sha
383 assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == new_data_with_sha
386 test "when the fallback source doesn't have all the files", ctx do
390 url: "https://nonshared-pack"
392 {:ok, {'empty.zip', empty_arch}} = :zip.zip('empty.zip', [], [:memory])
396 new_data = Map.put(ctx[:new_data], "fallback-src", "https://nonshared-pack")
398 assert ctx[:admin_conn]
399 |> put_req_header("content-type", "multipart/form-data")
400 |> patch("/api/pleroma/emoji/packs/test_pack", %{metadata: new_data})
401 |> json_response_and_validate_schema(:bad_request) == %{
402 "error" => "The fallback archive does not have all files specified in pack.json"
407 describe "POST/PATCH/DELETE /api/pleroma/emoji/packs/:name/files" do
409 pack_file = "#{@emoji_path}/test_pack/pack.json"
410 original_content = File.read!(pack_file)
413 File.write!(pack_file, original_content)
419 test "create shortcode exists", %{admin_conn: admin_conn} do
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(:conflict) == %{
431 "error" => "An emoji with the \"blank\" shortcode already exists"
435 test "don't rewrite old emoji", %{admin_conn: admin_conn} do
436 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/dir/") end)
439 |> put_req_header("content-type", "multipart/form-data")
440 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
442 filename: "dir/blank.png",
444 filename: "blank.png",
445 path: "#{@emoji_path}/test_pack/blank.png"
448 |> json_response_and_validate_schema(200) == %{
449 "blank" => "blank.png",
450 "blank2" => "blank2.png",
451 "blank3" => "dir/blank.png"
454 assert File.exists?("#{@emoji_path}/test_pack/dir/blank.png")
457 |> put_req_header("content-type", "multipart/form-data")
458 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
460 new_shortcode: "blank2",
461 new_filename: "dir_2/blank_3.png"
463 |> json_response_and_validate_schema(:conflict) == %{
465 "New shortcode \"blank2\" is already used. If you want to override emoji use 'force' option"
469 test "rewrite old emoji with force option", %{admin_conn: admin_conn} do
470 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/dir_2/") end)
473 |> put_req_header("content-type", "multipart/form-data")
474 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
476 filename: "dir/blank.png",
478 filename: "blank.png",
479 path: "#{@emoji_path}/test_pack/blank.png"
482 |> json_response_and_validate_schema(200) == %{
483 "blank" => "blank.png",
484 "blank2" => "blank2.png",
485 "blank3" => "dir/blank.png"
488 assert File.exists?("#{@emoji_path}/test_pack/dir/blank.png")
491 |> put_req_header("content-type", "multipart/form-data")
492 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
494 new_shortcode: "blank4",
495 new_filename: "dir_2/blank_3.png",
498 |> json_response_and_validate_schema(200) == %{
499 "blank" => "blank.png",
500 "blank2" => "blank2.png",
501 "blank4" => "dir_2/blank_3.png"
504 assert File.exists?("#{@emoji_path}/test_pack/dir_2/blank_3.png")
507 test "with empty filename", %{admin_conn: admin_conn} do
509 |> put_req_header("content-type", "multipart/form-data")
510 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
514 filename: "blank.png",
515 path: "#{@emoji_path}/test_pack/blank.png"
518 |> json_response_and_validate_schema(:bad_request) == %{
519 "error" => "pack name, shortcode or filename cannot be empty"
523 test "add file with not loaded pack", %{admin_conn: admin_conn} do
525 |> put_req_header("content-type", "multipart/form-data")
526 |> post("/api/pleroma/emoji/packs/not_loaded/files", %{
528 filename: "dir/blank.png",
530 filename: "blank.png",
531 path: "#{@emoji_path}/test_pack/blank.png"
534 |> json_response_and_validate_schema(:bad_request) == %{
535 "error" => "pack \"not_loaded\" is not found"
539 test "remove file with not loaded pack", %{admin_conn: admin_conn} do
541 |> delete("/api/pleroma/emoji/packs/not_loaded/files?shortcode=blank3")
542 |> json_response_and_validate_schema(:bad_request) == %{
543 "error" => "pack \"not_loaded\" is not found"
547 test "remove file with empty shortcode", %{admin_conn: admin_conn} do
549 |> delete("/api/pleroma/emoji/packs/not_loaded/files?shortcode=")
550 |> json_response_and_validate_schema(:bad_request) == %{
551 "error" => "pack name or shortcode cannot be empty"
555 test "update file with not loaded pack", %{admin_conn: admin_conn} do
557 |> put_req_header("content-type", "multipart/form-data")
558 |> patch("/api/pleroma/emoji/packs/not_loaded/files", %{
560 new_shortcode: "blank3",
561 new_filename: "dir_2/blank_3.png"
563 |> json_response_and_validate_schema(:bad_request) == %{
564 "error" => "pack \"not_loaded\" is not found"
568 test "new with shortcode as file with update", %{admin_conn: admin_conn} do
570 |> put_req_header("content-type", "multipart/form-data")
571 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
573 filename: "dir/blank.png",
575 filename: "blank.png",
576 path: "#{@emoji_path}/test_pack/blank.png"
579 |> json_response_and_validate_schema(200) == %{
580 "blank" => "blank.png",
581 "blank4" => "dir/blank.png",
582 "blank2" => "blank2.png"
585 assert File.exists?("#{@emoji_path}/test_pack/dir/blank.png")
588 |> put_req_header("content-type", "multipart/form-data")
589 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
591 new_shortcode: "blank3",
592 new_filename: "dir_2/blank_3.png"
594 |> json_response_and_validate_schema(200) == %{
595 "blank3" => "dir_2/blank_3.png",
596 "blank" => "blank.png",
597 "blank2" => "blank2.png"
600 refute File.exists?("#{@emoji_path}/test_pack/dir/")
601 assert File.exists?("#{@emoji_path}/test_pack/dir_2/blank_3.png")
604 |> delete("/api/pleroma/emoji/packs/test_pack/files?shortcode=blank3")
605 |> json_response_and_validate_schema(200) == %{
606 "blank" => "blank.png",
607 "blank2" => "blank2.png"
610 refute File.exists?("#{@emoji_path}/test_pack/dir_2/")
612 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/dir") end)
615 test "new with shortcode from url", %{admin_conn: admin_conn} do
619 url: "https://test-blank/blank_url.png"
621 text(File.read!("#{@emoji_path}/test_pack/blank.png"))
625 |> put_req_header("content-type", "multipart/form-data")
626 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
627 shortcode: "blank_url",
628 file: "https://test-blank/blank_url.png"
630 |> json_response_and_validate_schema(200) == %{
631 "blank_url" => "blank_url.png",
632 "blank" => "blank.png",
633 "blank2" => "blank2.png"
636 assert File.exists?("#{@emoji_path}/test_pack/blank_url.png")
638 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/blank_url.png") end)
641 test "new without shortcode", %{admin_conn: admin_conn} do
642 on_exit(fn -> File.rm_rf!("#{@emoji_path}/test_pack/shortcode.png") end)
645 |> put_req_header("content-type", "multipart/form-data")
646 |> post("/api/pleroma/emoji/packs/test_pack/files", %{
648 filename: "shortcode.png",
649 path: "#{Pleroma.Config.get([:instance, :static_dir])}/add/shortcode.png"
652 |> json_response_and_validate_schema(200) == %{
653 "shortcode" => "shortcode.png",
654 "blank" => "blank.png",
655 "blank2" => "blank2.png"
659 test "remove non existing shortcode in pack.json", %{admin_conn: admin_conn} do
661 |> delete("/api/pleroma/emoji/packs/test_pack/files?shortcode=blank3")
662 |> json_response_and_validate_schema(:bad_request) == %{
663 "error" => "Emoji \"blank3\" does not exist"
667 test "update non existing emoji", %{admin_conn: admin_conn} do
669 |> put_req_header("content-type", "multipart/form-data")
670 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
672 new_shortcode: "blank4",
673 new_filename: "dir_2/blank_3.png"
675 |> json_response_and_validate_schema(:bad_request) == %{
676 "error" => "Emoji \"blank3\" does not exist"
680 test "update with empty shortcode", %{admin_conn: admin_conn} do
682 "error" => "Missing field: new_shortcode."
685 |> put_req_header("content-type", "multipart/form-data")
686 |> patch("/api/pleroma/emoji/packs/test_pack/files", %{
688 new_filename: "dir_2/blank_3.png"
690 |> json_response_and_validate_schema(:bad_request)
694 describe "POST/DELETE /api/pleroma/emoji/packs/:name" do
695 test "creating and deleting a pack", %{admin_conn: admin_conn} do
697 |> post("/api/pleroma/emoji/packs/test_created")
698 |> json_response_and_validate_schema(200) == "ok"
700 assert File.exists?("#{@emoji_path}/test_created/pack.json")
702 assert Jason.decode!(File.read!("#{@emoji_path}/test_created/pack.json")) == %{
709 |> delete("/api/pleroma/emoji/packs/test_created")
710 |> json_response_and_validate_schema(200) == "ok"
712 refute File.exists?("#{@emoji_path}/test_created/pack.json")
715 test "if pack exists", %{admin_conn: admin_conn} do
716 path = Path.join(@emoji_path, "test_created")
718 pack_file = Jason.encode!(%{files: %{}, pack: %{}})
719 File.write!(Path.join(path, "pack.json"), pack_file)
722 |> post("/api/pleroma/emoji/packs/test_created")
723 |> json_response_and_validate_schema(:conflict) == %{
724 "error" => "A pack named \"test_created\" already exists"
727 on_exit(fn -> File.rm_rf(path) end)
730 test "with empty name", %{admin_conn: admin_conn} do
732 |> post("/api/pleroma/emoji/packs/ ")
733 |> json_response_and_validate_schema(:bad_request) == %{
734 "error" => "pack name cannot be empty"
739 test "deleting nonexisting pack", %{admin_conn: admin_conn} do
741 |> delete("/api/pleroma/emoji/packs/non_existing")
742 |> json_response_and_validate_schema(:not_found) == %{
743 "error" => "Pack non_existing does not exist"
747 test "deleting with empty name", %{admin_conn: admin_conn} do
749 |> delete("/api/pleroma/emoji/packs/ ")
750 |> json_response_and_validate_schema(:bad_request) == %{
751 "error" => "pack name cannot be empty"
755 test "filesystem import", %{admin_conn: admin_conn, conn: conn} do
757 File.rm!("#{@emoji_path}/test_pack_for_import/emoji.txt")
758 File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
761 resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
763 refute Map.has_key?(resp["packs"], "test_pack_for_import")
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)
770 assert resp["packs"]["test_pack_for_import"]["files"] == %{"blank" => "blank.png"}
772 File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
773 refute File.exists?("#{@emoji_path}/test_pack_for_import/pack.json")
775 emoji_txt_content = """
776 blank, blank.png, Fun
778 foo, /emoji/test_pack_for_import/blank.png
782 File.write!("#{@emoji_path}/test_pack_for_import/emoji.txt", emoji_txt_content)
785 |> get("/api/pleroma/emoji/packs/import")
786 |> json_response_and_validate_schema(200) == ["test_pack_for_import"]
788 resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
790 assert resp["packs"]["test_pack_for_import"]["files"] == %{
791 "blank" => "blank.png",
792 "blank2" => "blank.png",
797 describe "GET /api/pleroma/emoji/packs/:name" do
798 test "shows pack.json", %{conn: conn} do
803 "can-download" => true,
804 "description" => "Test description",
805 "download-sha256" => _,
806 "homepage" => "https://pleroma.social",
807 "license" => "Test license",
808 "share-files" => true
812 |> get("/api/pleroma/emoji/packs/test_pack")
813 |> json_response_and_validate_schema(200)
815 assert files == %{"blank" => "blank.png", "blank2" => "blank2.png"}
822 |> get("/api/pleroma/emoji/packs/test_pack?page_size=1")
823 |> json_response_and_validate_schema(200)
825 assert files |> Map.keys() |> length() == 1
832 |> get("/api/pleroma/emoji/packs/test_pack?page_size=1&page=2")
833 |> json_response_and_validate_schema(200)
835 assert files |> Map.keys() |> length() == 1
838 test "non existing pack", %{conn: conn} do
840 |> get("/api/pleroma/emoji/packs/non_existing")
841 |> json_response_and_validate_schema(:not_found) == %{
842 "error" => "Pack non_existing does not exist"
846 test "error name", %{conn: conn} do
848 |> get("/api/pleroma/emoji/packs/ ")
849 |> json_response_and_validate_schema(:bad_request) == %{
850 "error" => "pack name cannot be empty"