summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/upload_test.exs12
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs9
2 files changed, 21 insertions, 0 deletions
diff --git a/test/upload_test.exs b/test/upload_test.exs
index 71041e83c..f90c4d713 100644
--- a/test/upload_test.exs
+++ b/test/upload_test.exs
@@ -9,5 +9,17 @@ defmodule Pleroma.UploadTest do
assert data["name"] == "an [image.jpg"
assert List.first(data["url"])["href"] == "http://localhost:4001/media/#{data["uuid"]}/an%20%5Bimage.jpg"
end
+
+ test "fixes an incorrect content type" do
+ file = %Plug.Upload{content_type: "application/octet-stream", path: Path.absname("test/fixtures/image.jpg"), filename: "an [image.jpg"}
+ data = Upload.store(file)
+ assert hd(data["url"])["mediaType"] == "image/jpeg"
+ end
+
+ test "does not modify a valid content type" do
+ file = %Plug.Upload{content_type: "image/png", path: Path.absname("test/fixtures/image.jpg"), filename: "an [image.jpg"}
+ data = Upload.store(file)
+ assert hd(data["url"])["mediaType"] == "image/png"
+ end
end
end
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 72ce77c81..47a613837 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -386,6 +386,15 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert status["id"] == to_string(activity.id)
end
+ test "search fetches remote statuses", %{conn: conn} do
+ conn = conn
+ |> get("/api/v1/search", %{"q" => "https://shitposter.club/notice/2827873"})
+ assert results = json_response(conn, 200)
+
+ [status] = results["statuses"]
+ assert status["uri"] == "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
+ end
+
test "search fetches remote accounts", %{conn: conn} do
conn = conn
|> get("/api/v1/search", %{"q" => "shp@social.heldscal.la", "resolve" => "true"})