X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fmastodon_api%2Fmastodon_api_controller_test.exs;h=e4c59d9ffa1916a1d6e9c51e8c04d678edb4bcd6;hb=33a5d0a2385984168f7de063093c6a71c8b07b73;hp=fc00105695bcce4219a90b0d76c41acd4caa67a3;hpb=72f7baa6548dbd5cc5ae4c37d9c2e53126203449;p=akkoma
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index fc0010569..e4c59d9ff 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -35,7 +35,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
{:ok, [_activity]} = OStatus.fetch_activity_from_url("https://shitposter.club/notice/2827873")
conn = conn
- |> get("/api/v1/timelines/public")
+ |> get("/api/v1/timelines/public", %{"local" => "False"})
assert length(json_response(conn, 200)) == 2
@@ -43,6 +43,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> get("/api/v1/timelines/public", %{"local" => "True"})
assert [%{"content" => "test"}] = json_response(conn, 200)
+
+ conn = build_conn()
+ |> get("/api/v1/timelines/public", %{"local" => "1"})
+
+ assert [%{"content" => "test"}] = json_response(conn, 200)
end
test "posting a status", %{conn: conn} do
@@ -50,9 +55,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
conn = conn
|> assign(:user, user)
- |> post("/api/v1/statuses", %{"status" => "cofe", "spoiler_text" => "2hu"})
+ |> post("/api/v1/statuses", %{"status" => "cofe", "spoiler_text" => "2hu", "sensitive" => "false"})
- assert %{"content" => "cofe", "id" => id, "spoiler_text" => "2hu"} = json_response(conn, 200)
+ assert %{"content" => "cofe", "id" => id, "spoiler_text" => "2hu", "sensitive" => false} = json_response(conn, 200)
assert Repo.get(Activity, id)
end
@@ -145,7 +150,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> get("/api/v1/notifications")
- expected_response = "hi @#{user.nickname}"
+ expected_response = "hi @#{user.nickname}"
assert [%{"status" => %{"content" => response}} | _rest] = json_response(conn, 200)
assert response == expected_response
end
@@ -161,7 +166,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> get("/api/v1/notifications/#{notification.id}")
- expected_response = "hi @#{user.nickname}"
+ expected_response = "hi @#{user.nickname}"
assert %{"status" => %{"content" => response}} = json_response(conn, 200)
assert response == expected_response
end
@@ -525,7 +530,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
describe "updating credentials" do
- test "updates the user's bio" do
+ test "updates the user's bio", %{conn: conn} do
user = insert(:user)
conn = conn
@@ -536,7 +541,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert user["note"] == "I drink #cofe"
end
- test "updates the user's name" do
+ test "updates the user's name", %{conn: conn} do
user = insert(:user)
conn = conn
@@ -547,7 +552,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert user["display_name"] == "markorepairs"
end
- test "updates the user's avatar" do
+ test "updates the user's avatar", %{conn: conn} do
user = insert(:user)
new_avatar = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"}
@@ -560,7 +565,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert user["avatar"] != "https://placehold.it/48x48"
end
- test "updates the user's banner" do
+ test "updates the user's banner", %{conn: conn} do
user = insert(:user)
new_header = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"}
@@ -574,18 +579,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
end
- test "get instance information" do
+ test "get instance information", %{conn: conn} do
insert(:user, %{local: true})
user = insert(:user, %{local: true})
insert(:user, %{local: false})
{:ok, _} = TwitterAPI.create_status(user, %{"status" => "cofe"})
+ Pleroma.Stats.update_stats()
+
conn = conn
|> get("/api/v1/instance")
assert result = json_response(conn, 200)
assert result["stats"]["user_count"] == 2
+ assert result["stats"]["status_count"] == 1
end
end