diff options
Diffstat (limited to 'test')
6 files changed, 13 insertions, 161 deletions
| diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/web/mastodon_api/controllers/notification_controller_test.exs index d9356a844..562fc4d8e 100644 --- a/test/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/web/mastodon_api/controllers/notification_controller_test.exs @@ -12,9 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do    import Pleroma.Factory -  test "does NOT render account/pleroma/relationship if this is disabled by default" do -    clear_config([:extensions, :output_relationships_in_statuses_by_default], false) - +  test "does NOT render account/pleroma/relationship by default" do      %{user: user, conn: conn} = oauth_access(["read:notifications"])      other_user = 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 a4403132c..bdee88fd3 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -1176,7 +1176,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do    end    test "bookmarks" do -    bookmarks_uri = "/api/v1/bookmarks?with_relationships=true" +    bookmarks_uri = "/api/v1/bookmarks"      %{conn: conn} = oauth_access(["write:bookmarks", "read:bookmarks"])      author = insert(:user) diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/web/mastodon_api/controllers/timeline_controller_test.exs index f8b9289f3..2375ac8e8 100644 --- a/test/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/web/mastodon_api/controllers/timeline_controller_test.exs @@ -20,12 +20,10 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do    describe "home" do      setup do: oauth_access(["read:statuses"]) -    test "does NOT render account/pleroma/relationship if this is disabled by default", %{ +    test "does NOT embed account/pleroma/relationship in statuses", %{        user: user,        conn: conn      } do -      clear_config([:extensions, :output_relationships_in_statuses_by_default], false) -        other_user = insert(:user)        {:ok, _} = CommonAPI.post(other_user, %{status: "hi @#{user.nickname}"}) @@ -41,72 +39,6 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do               end)      end -    test "the home timeline", %{user: user, conn: conn} do -      uri = "/api/v1/timelines/home?with_relationships=1" - -      following = insert(:user, nickname: "followed") -      third_user = insert(:user, nickname: "repeated") - -      {:ok, _activity} = CommonAPI.post(following, %{status: "post"}) -      {:ok, activity} = CommonAPI.post(third_user, %{status: "repeated post"}) -      {:ok, _, _} = CommonAPI.repeat(activity.id, following) - -      ret_conn = get(conn, uri) - -      assert Enum.empty?(json_response_and_validate_schema(ret_conn, :ok)) - -      {:ok, _user} = User.follow(user, following) - -      ret_conn = get(conn, uri) - -      assert [ -               %{ -                 "reblog" => %{ -                   "content" => "repeated post", -                   "account" => %{ -                     "pleroma" => %{ -                       "relationship" => %{"following" => false, "followed_by" => false} -                     } -                   } -                 }, -                 "account" => %{"pleroma" => %{"relationship" => %{"following" => true}}} -               }, -               %{ -                 "content" => "post", -                 "account" => %{ -                   "acct" => "followed", -                   "pleroma" => %{"relationship" => %{"following" => true}} -                 } -               } -             ] = json_response_and_validate_schema(ret_conn, :ok) - -      {:ok, _user} = User.follow(third_user, user) - -      ret_conn = get(conn, uri) - -      assert [ -               %{ -                 "reblog" => %{ -                   "content" => "repeated post", -                   "account" => %{ -                     "acct" => "repeated", -                     "pleroma" => %{ -                       "relationship" => %{"following" => false, "followed_by" => true} -                     } -                   } -                 }, -                 "account" => %{"pleroma" => %{"relationship" => %{"following" => true}}} -               }, -               %{ -                 "content" => "post", -                 "account" => %{ -                   "acct" => "followed", -                   "pleroma" => %{"relationship" => %{"following" => true}} -                 } -               } -             ] = json_response_and_validate_schema(ret_conn, :ok) -    end -      test "the home timeline when the direct messages are excluded", %{user: user, conn: conn} do        {:ok, public_activity} = CommonAPI.post(user, %{status: ".", visibility: "public"})        {:ok, direct_activity} = CommonAPI.post(user, %{status: ".", visibility: "direct"}) diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index 69ddbb5d4..487ec26c2 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -302,82 +302,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do      end    end -  test "represent an embedded relationship" do -    user = -      insert(:user, %{ -        follower_count: 0, -        note_count: 5, -        actor_type: "Service", -        nickname: "shp@shitposter.club", -        inserted_at: ~N[2017-08-15 15:47:06.597036] -      }) - -    other_user = insert(:user) -    {:ok, other_user} = User.follow(other_user, user) -    {:ok, _user_relationship} = User.block(other_user, user) -    {:ok, _} = User.follow(insert(:user), user) - -    expected = %{ -      id: to_string(user.id), -      username: "shp", -      acct: user.nickname, -      display_name: user.name, -      locked: false, -      created_at: "2017-08-15T15:47:06.000Z", -      followers_count: 1, -      following_count: 0, -      statuses_count: 5, -      note: user.bio, -      url: user.ap_id, -      avatar: "http://localhost:4001/images/avi.png", -      avatar_static: "http://localhost:4001/images/avi.png", -      header: "http://localhost:4001/images/banner.png", -      header_static: "http://localhost:4001/images/banner.png", -      emojis: [], -      fields: [], -      bot: true, -      source: %{ -        note: user.bio, -        sensitive: false, -        pleroma: %{ -          actor_type: "Service", -          discoverable: false -        }, -        fields: [] -      }, -      pleroma: %{ -        background_image: nil, -        confirmation_pending: false, -        tags: [], -        is_admin: false, -        is_moderator: false, -        hide_favorites: true, -        hide_followers: false, -        hide_follows: false, -        hide_followers_count: false, -        hide_follows_count: false, -        relationship: %{ -          id: to_string(user.id), -          following: false, -          followed_by: false, -          blocking: true, -          blocked_by: false, -          subscribing: false, -          muting: false, -          muting_notifications: false, -          requested: false, -          domain_blocking: false, -          showing_reblogs: true, -          endorsed: false -        }, -        skip_thread_containment: false -      } -    } - -    assert expected == -             AccountView.render("show.json", %{user: refresh_record(user), for: other_user}) -  end -    test "returns the settings store if the requesting user is the represented user and it's requested specifically" do      user = insert(:user, pleroma_settings_store: %{fe: "test"}) diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs index 04a774d17..9839e48fc 100644 --- a/test/web/mastodon_api/views/notification_view_test.exs +++ b/test/web/mastodon_api/views/notification_view_test.exs @@ -42,7 +42,11 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do        id: to_string(notification.id),        pleroma: %{is_seen: false},        type: "mention", -      account: AccountView.render("show.json", %{user: user, for: mentioned_user}), +      account: +        AccountView.render("show.json", %{ +          user: user, +          for: mentioned_user +        }),        status: StatusView.render("show.json", %{activity: activity, for: mentioned_user}),        created_at: Utils.to_masto_date(notification.inserted_at)      } diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/web/mastodon_api/views/status_view_test.exs index ffad65b01..5d7adbe29 100644 --- a/test/web/mastodon_api/views/status_view_test.exs +++ b/test/web/mastodon_api/views/status_view_test.exs @@ -576,7 +576,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do      end    end -  test "embeds a relationship in the account" do +  test "does not embed a relationship in the account" do      user = insert(:user)      other_user = insert(:user) @@ -587,13 +587,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do      result = StatusView.render("show.json", %{activity: activity, for: other_user}) -    assert result[:account][:pleroma][:relationship] == -             AccountView.render("relationship.json", %{user: other_user, target: user}) - +    assert result[:account][:pleroma][:relationship] == %{}      assert_schema(result, "Status", Pleroma.Web.ApiSpec.spec())    end -  test "embeds a relationship in the account in reposts" do +  test "does not embed a relationship in the account in reposts" do      user = insert(:user)      other_user = insert(:user) @@ -606,12 +604,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do      result = StatusView.render("show.json", %{activity: activity, for: user}) -    assert result[:account][:pleroma][:relationship] == -             AccountView.render("relationship.json", %{user: user, target: other_user}) - -    assert result[:reblog][:account][:pleroma][:relationship] == -             AccountView.render("relationship.json", %{user: user, target: user}) - +    assert result[:account][:pleroma][:relationship] == %{} +    assert result[:reblog][:account][:pleroma][:relationship] == %{}      assert_schema(result, "Status", Pleroma.Web.ApiSpec.spec())    end | 
