diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-11-10 17:37:54 +0100 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-11-10 17:37:54 +0100 |
commit | 1d3d66a841253a244e5166726ba4f3d1f21651c3 (patch) | |
tree | b1d0c230d9bfebd139b527392e5399fa647781d9 /test | |
parent | 6e9c22c0afaa67f0b94f602eceef5c57b7c9192f (diff) | |
parent | 1b8ad9f731708a3231ef01a5db1fba2516d48d98 (diff) | |
download | pleroma-1d3d66a841253a244e5166726ba4f3d1f21651c3.tar.gz pleroma-1d3d66a841253a244e5166726ba4f3d1f21651c3.zip |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into develop
Diffstat (limited to 'test')
-rw-r--r-- | test/upload_test.exs | 12 | ||||
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 9 |
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"}) |