diff options
Diffstat (limited to 'test/web')
| -rw-r--r-- | test/web/common_api/common_api_test.exs | 2 | ||||
| -rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 11 | ||||
| -rw-r--r-- | test/web/mastodon_api/views/status_view_test.exs | 1 | 
3 files changed, 11 insertions, 3 deletions
| diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index fc3bb845d..908ee5484 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -491,6 +491,7 @@ defmodule Pleroma.Web.CommonAPITest do        object = Object.normalize(activity)        assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')" +      assert object.data["source"] == post      end      test "it filters out obviously bad tags when accepting a post as Markdown" do @@ -507,6 +508,7 @@ defmodule Pleroma.Web.CommonAPITest do        object = Object.normalize(activity)        assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')" +      assert object.data["source"] == post      end      test "it does not allow replies to direct messages that are not direct messages themselves" do diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index a98e939e8..fd2de8d80 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -760,13 +760,18 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do      test "when you created it" do        %{user: author, conn: conn} = oauth_access(["write:statuses"])        activity = insert(:note_activity, user: author) +      object = Object.normalize(activity) -      conn = +      content = object.data["content"] +      source = object.data["source"] + +      result =          conn          |> assign(:user, author)          |> delete("/api/v1/statuses/#{activity.id}") +        |> json_response_and_validate_schema(200) -      assert %{} = json_response_and_validate_schema(conn, 200) +      assert match?(%{"content" => ^content, "text" => ^source}, result)        refute Activity.get_by_id(activity.id)      end @@ -789,7 +794,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        conn = delete(conn, "/api/v1/statuses/#{activity.id}") -      assert %{"error" => _} = json_response_and_validate_schema(conn, 403) +      assert %{"error" => "Record not found"} == json_response_and_validate_schema(conn, 404)        assert Activity.get_by_id(activity.id) == activity      end diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/web/mastodon_api/views/status_view_test.exs index f90a0c273..fa26b3129 100644 --- a/test/web/mastodon_api/views/status_view_test.exs +++ b/test/web/mastodon_api/views/status_view_test.exs @@ -183,6 +183,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do        card: nil,        reblog: nil,        content: HTML.filter_tags(object_data["content"]), +      text: nil,        created_at: created_at,        reblogs_count: 0,        replies_count: 0, | 
