aboutsummaryrefslogtreecommitdiff
path: root/test/web/twitter_api/util_controller_test.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-04-08 14:10:51 +0200
committerlain <lain@soykaf.club>2019-04-08 14:10:51 +0200
commita9f805c87100fd2ee1d8426460b81af4a235d574 (patch)
tree70179175f0ff84f3f4c7399f63694766aaa65b35 /test/web/twitter_api/util_controller_test.exs
parent5d871173d189a0019fda0ee76f8a324d90a163ee (diff)
parent4977e96fa408e8148a355b3c759af34ae3ca312d (diff)
downloadpleroma-a9f805c87100fd2ee1d8426460b81af4a235d574.tar.gz
Merge remote-tracking branch 'origin/develop' into features/mastoapi/2.6.0-conversations
Diffstat (limited to 'test/web/twitter_api/util_controller_test.exs')
-rw-r--r--test/web/twitter_api/util_controller_test.exs48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs
index 832fdc096..410f20f87 100644
--- a/test/web/twitter_api/util_controller_test.exs
+++ b/test/web/twitter_api/util_controller_test.exs
@@ -6,6 +6,11 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
alias Pleroma.Web.CommonAPI
import Pleroma.Factory
+ setup do
+ Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
+ :ok
+ end
+
describe "POST /api/pleroma/follow_import" do
test "it returns HTTP 200", %{conn: conn} do
user1 = insert(:user)
@@ -164,4 +169,47 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
assert response == Jason.encode!(config |> Enum.into(%{})) |> Jason.decode!()
end
end
+
+ describe "/api/pleroma/emoji" do
+ test "returns json with custom emoji with tags", %{conn: conn} do
+ [emoji | _body] =
+ conn
+ |> get("/api/pleroma/emoji")
+ |> json_response(200)
+
+ [key] = Map.keys(emoji)
+
+ %{
+ ^key => %{
+ "image_url" => url,
+ "tags" => tags
+ }
+ } = emoji
+
+ assert is_binary(url)
+ assert is_list(tags)
+ end
+ end
+
+ describe "GET /ostatus_subscribe?acct=...." do
+ test "adds status to pleroma instance if the `acct` is a status", %{conn: conn} do
+ conn =
+ get(
+ conn,
+ "/ostatus_subscribe?acct=https://mastodon.social/users/emelie/statuses/101849165031453009"
+ )
+
+ assert redirected_to(conn) =~ "/notice/"
+ end
+
+ test "show follow account page if the `acct` is a account link", %{conn: conn} do
+ response =
+ get(
+ conn,
+ "/ostatus_subscribe?acct=https://mastodon.social/users/emelie"
+ )
+
+ assert html_response(response, 200) =~ "Log in to follow"
+ end
+ end
end