X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Frich_media%2Fhelpers_test.exs;h=8264a9c4166bfbb3c8f29f72120845c76122c20e;hb=1e49bfa9acb4176a161181edcaf04e886c638c42;hp=92198f3d9b91abeb8851ae76cc4bbd8b4b136a2d;hpb=8f2cb820c0cc41791cea7884cf4dd1726d227cc0;p=akkoma
diff --git a/test/web/rich_media/helpers_test.exs b/test/web/rich_media/helpers_test.exs
index 92198f3d9..8264a9c41 100644
--- a/test/web/rich_media/helpers_test.exs
+++ b/test/web/rich_media/helpers_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.RichMedia.HelpersTest do
@@ -15,19 +15,19 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do
setup do
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
- rich_media = Config.get([:rich_media, :enabled])
- on_exit(fn -> Config.put([:rich_media, :enabled], rich_media) end)
:ok
end
+ setup do: clear_config([:rich_media, :enabled])
+
test "refuses to crawl incomplete URLs" do
user = insert(:user)
{:ok, activity} =
CommonAPI.post(user, %{
- "status" => "[test](example.com/ogp)",
- "content_type" => "text/markdown"
+ status: "[test](example.com/ogp)",
+ content_type: "text/markdown"
})
Config.put([:rich_media, :enabled], true)
@@ -40,8 +40,8 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do
{:ok, activity} =
CommonAPI.post(user, %{
- "status" => "[test](example.com[]/ogp)",
- "content_type" => "text/markdown"
+ status: "[test](example.com[]/ogp)",
+ content_type: "text/markdown"
})
Config.put([:rich_media, :enabled], true)
@@ -54,8 +54,8 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do
{:ok, activity} =
CommonAPI.post(user, %{
- "status" => "[test](https://example.com/ogp)",
- "content_type" => "text/markdown"
+ status: "[test](https://example.com/ogp)",
+ content_type: "text/markdown"
})
Config.put([:rich_media, :enabled], true)
@@ -69,8 +69,8 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do
{:ok, activity} =
CommonAPI.post(user, %{
- "status" => "http://example.com/ogp",
- "sensitive" => true
+ status: "http://example.com/ogp",
+ sensitive: true
})
%Object{} = object = Object.normalize(activity)
@@ -87,7 +87,7 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do
{:ok, activity} =
CommonAPI.post(user, %{
- "status" => "http://example.com/ogp #nsfw"
+ status: "http://example.com/ogp #nsfw"
})
%Object{} = object = Object.normalize(activity)
@@ -103,12 +103,12 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do
user = insert(:user)
{:ok, activity} =
- CommonAPI.post(user, %{"status" => "http://127.0.0.1:4000/notice/9kCP7VNyPJXFOXDrgO"})
+ CommonAPI.post(user, %{status: "http://127.0.0.1:4000/notice/9kCP7VNyPJXFOXDrgO"})
- {:ok, activity2} = CommonAPI.post(user, %{"status" => "https://10.111.10.1/notice/9kCP7V"})
- {:ok, activity3} = CommonAPI.post(user, %{"status" => "https://172.16.32.40/notice/9kCP7V"})
- {:ok, activity4} = CommonAPI.post(user, %{"status" => "https://192.168.10.40/notice/9kCP7V"})
- {:ok, activity5} = CommonAPI.post(user, %{"status" => "https://pleroma.local/notice/9kCP7V"})
+ {:ok, activity2} = CommonAPI.post(user, %{status: "https://10.111.10.1/notice/9kCP7V"})
+ {:ok, activity3} = CommonAPI.post(user, %{status: "https://172.16.32.40/notice/9kCP7V"})
+ {:ok, activity4} = CommonAPI.post(user, %{status: "https://192.168.10.40/notice/9kCP7V"})
+ {:ok, activity5} = CommonAPI.post(user, %{status: "https://pleroma.local/notice/9kCP7V"})
Config.put([:rich_media, :enabled], true)