diff options
Diffstat (limited to 'test/web/mastodon_api/views')
| -rw-r--r-- | test/web/mastodon_api/views/account_view_test.exs | 16 | ||||
| -rw-r--r-- | test/web/mastodon_api/views/poll_view_test.exs | 16 | ||||
| -rw-r--r-- | test/web/mastodon_api/views/subscription_view_test.exs (renamed from test/web/mastodon_api/views/push_subscription_view_test.exs) | 6 | 
3 files changed, 19 insertions, 19 deletions
diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index 4435f69ff..85fa4f6a2 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -19,16 +19,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do    end    test "Represent a user account" do -    source_data = %{ -      "tag" => [ -        %{ -          "type" => "Emoji", -          "icon" => %{"url" => "/file.png"}, -          "name" => ":karjalanpiirakka:" -        } -      ] -    } -      background_image = %{        "url" => [%{"href" => "https://example.com/images/asuka_hospital.png"}]      } @@ -37,13 +27,13 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do        insert(:user, %{          follower_count: 3,          note_count: 5, -        source_data: source_data,          background: background_image,          nickname: "shp@shitposter.club",          name: ":karjalanpiirakka: shp",          bio:            "<script src=\"invalid-html\"></script><span>valid html</span>. a<br>b<br/>c<br >d<br />f", -        inserted_at: ~N[2017-08-15 15:47:06.597036] +        inserted_at: ~N[2017-08-15 15:47:06.597036], +        emoji: %{"karjalanpiirakka" => "/file.png"}        })      expected = %{ @@ -117,7 +107,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do        insert(:user, %{          follower_count: 3,          note_count: 5, -        source_data: %{},          actor_type: "Service",          nickname: "shp@shitposter.club",          inserted_at: ~N[2017-08-15 15:47:06.597036] @@ -311,7 +300,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do        insert(:user, %{          follower_count: 0,          note_count: 5, -        source_data: %{},          actor_type: "Service",          nickname: "shp@shitposter.club",          inserted_at: ~N[2017-08-15 15:47:06.597036] diff --git a/test/web/mastodon_api/views/poll_view_test.exs b/test/web/mastodon_api/views/poll_view_test.exs index 6211fa888..63b204387 100644 --- a/test/web/mastodon_api/views/poll_view_test.exs +++ b/test/web/mastodon_api/views/poll_view_test.exs @@ -43,7 +43,8 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do          %{title: "why are you even asking?", votes_count: 0}        ],        voted: false, -      votes_count: 0 +      votes_count: 0, +      voters_count: nil      }      result = PollView.render("show.json", %{object: object}) @@ -69,9 +70,20 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do          }        }) +    voter = insert(:user) +      object = Object.normalize(activity) -    assert %{multiple: true} = PollView.render("show.json", %{object: object}) +    {:ok, _votes, object} = CommonAPI.vote(voter, object, [0, 1]) + +    assert match?( +             %{ +               multiple: true, +               voters_count: 1, +               votes_count: 2 +             }, +             PollView.render("show.json", %{object: object}) +           )    end    test "detects emoji" do diff --git a/test/web/mastodon_api/views/push_subscription_view_test.exs b/test/web/mastodon_api/views/subscription_view_test.exs index 10c6082a5..981524c0e 100644 --- a/test/web/mastodon_api/views/push_subscription_view_test.exs +++ b/test/web/mastodon_api/views/subscription_view_test.exs @@ -2,10 +2,10 @@  # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.MastodonAPI.PushSubscriptionViewTest do +defmodule Pleroma.Web.MastodonAPI.SubscriptionViewTest do    use Pleroma.DataCase    import Pleroma.Factory -  alias Pleroma.Web.MastodonAPI.PushSubscriptionView, as: View +  alias Pleroma.Web.MastodonAPI.SubscriptionView, as: View    alias Pleroma.Web.Push    test "Represent a subscription" do @@ -18,6 +18,6 @@ defmodule Pleroma.Web.MastodonAPI.PushSubscriptionViewTest do        server_key: Keyword.get(Push.vapid_config(), :public_key)      } -    assert expected == View.render("push_subscription.json", %{subscription: subscription}) +    assert expected == View.render("show.json", %{subscription: subscription})    end  end  | 
