diff options
Diffstat (limited to 'test/web/mastodon_api')
5 files changed, 20 insertions, 5 deletions
| diff --git a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs index 09bdc46e0..82d9e7d2f 100644 --- a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs +++ b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs @@ -269,7 +269,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do          |> json_response(200)        assert account_data["fields"] == [ -               %{"name" => "foo", "value" => "bar"}, +               %{"name" => "<a href=\"http://google.com\">foo</a>", "value" => "bar"},                 %{"name" => "link", "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)}               ] @@ -297,7 +297,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do          |> json_response(200)        assert account["fields"] == [ -               %{"name" => "foo", "value" => "bar"}, +               %{"name" => "<a href=\"http://google.com\">foo</a>", "value" => "bar"},                 %{"name" => "link", "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)}               ] diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/web/mastodon_api/controllers/account_controller_test.exs index ec1e18002..e2abcd7c5 100644 --- a/test/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/web/mastodon_api/controllers/account_controller_test.exs @@ -457,6 +457,16 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do        assert id == to_string(other_user.id)      end +    test "cancelling follow request", %{conn: conn} do +      %{id: other_user_id} = insert(:user, %{locked: true}) + +      assert %{"id" => ^other_user_id, "following" => false, "requested" => true} = +               conn |> post("/api/v1/accounts/#{other_user_id}/follow") |> json_response(:ok) + +      assert %{"id" => ^other_user_id, "following" => false, "requested" => false} = +               conn |> post("/api/v1/accounts/#{other_user_id}/unfollow") |> json_response(:ok) +    end +      test "following without reblogs" do        %{conn: conn} = oauth_access(["follow", "read:statuses"])        followed = insert(:user) diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index b03b4b344..83138d7ef 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -370,6 +370,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        assert NaiveDateTime.diff(NaiveDateTime.from_iso8601!(response["poll"]["expires_at"]), time) in 420..430        refute response["poll"]["expred"] + +      question = Object.get_by_id(response["poll"]["id"]) + +      # closed contains utc timezone +      assert question.data["closed"] =~ "Z"      end      test "option limit is enforced", %{conn: conn} do diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index 2107bb85c..00c294845 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -368,10 +368,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do      assert result.pleroma[:settings_store] == nil    end -  test "sanitizes display names" do +  test "doesn't sanitize display names" do      user = insert(:user, name: "<marquee> username </marquee>")      result = AccountView.render("show.json", %{user: user}) -    refute result.display_name == "<marquee> username </marquee>" +    assert result.display_name == "<marquee> username </marquee>"    end    test "never display nil user follow counts" do diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs index 1fe83cb2c..2ac75c2ff 100644 --- a/test/web/mastodon_api/views/notification_view_test.exs +++ b/test/web/mastodon_api/views/notification_view_test.exs @@ -135,7 +135,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do               NotificationView.render("index.json", %{notifications: [notification], for: follower})    end -  test "EmojiReaction notification" do +  test "EmojiReact notification" do      user = insert(:user)      other_user = insert(:user) | 
