Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/local-only...
[akkoma] / test / pleroma / web / mastodon_api / controllers / status_controller_test.exs
index 497a6bb1207814a09be483c9c322a4462b33eeb3..d95200f99a2db1f7aa9bbf07c318e77ea4f6ffc6 100644 (file)
@@ -167,7 +167,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
 
     test "posting an undefined status with an attachment", %{user: user, conn: conn} do
       file = %Plug.Upload{
-        content_type: "image/jpg",
+        content_type: "image/jpeg",
         path: Path.absname("test/fixtures/image.jpg"),
         filename: "an_image.jpg"
       }
@@ -408,7 +408,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
         |> Kernel.<>("Z")
 
       file = %Plug.Upload{
-        content_type: "image/jpg",
+        content_type: "image/jpeg",
         path: Path.absname("test/fixtures/image.jpg"),
         filename: "an_image.jpg"
       }
@@ -1740,4 +1740,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
              |> get("/api/v1/statuses/#{activity.id}")
              |> json_response_and_validate_schema(:ok)
   end
+
+  test "posting a local only status" do
+    %{user: _user, conn: conn} = oauth_access(["write:statuses"])
+
+    conn_one =
+      conn
+      |> put_req_header("content-type", "application/json")
+      |> post("/api/v1/statuses", %{
+        "status" => "cofe",
+        "visibility" => "local"
+      })
+
+    local = Pleroma.Constants.as_local_public()
+
+    assert %{"content" => "cofe", "id" => id, "visibility" => "local"} =
+             json_response(conn_one, 200)
+
+    assert %Activity{id: ^id, data: %{"to" => [^local]}} = Activity.get_by_id(id)
+  end
 end