diff options
Diffstat (limited to 'test/web/mastodon_api')
| -rw-r--r-- | test/web/mastodon_api/controllers/mastodon_api_controller/update_credentials_test.exs | 9 | ||||
| -rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 24 | 
2 files changed, 24 insertions, 9 deletions
| diff --git a/test/web/mastodon_api/controllers/mastodon_api_controller/update_credentials_test.exs b/test/web/mastodon_api/controllers/mastodon_api_controller/update_credentials_test.exs index 89d4ca37e..560f55137 100644 --- a/test/web/mastodon_api/controllers/mastodon_api_controller/update_credentials_test.exs +++ b/test/web/mastodon_api/controllers/mastodon_api_controller/update_credentials_test.exs @@ -86,10 +86,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do        assert user = json_response(conn, 200)        assert user["note"] == -               ~s(I drink <a class="hashtag" data-tag="cofe" href="http://localhost:4001/tag/cofe" rel="tag">#cofe</a> with <span class="h-card"><a data-user=") <> -                 user2.id <> -                 ~s(" class="u-url mention" href=") <> -                 user2.ap_id <> ~s(">@<span>) <> user2.nickname <> ~s(</span></a></span>) +               ~s(I drink <a class="hashtag" data-tag="cofe" href="http://localhost:4001/tag/cofe">#cofe</a> with <span class="h-card"><a data-user="#{ +                 user2.id +               }" class="u-url mention" href="#{user2.ap_id}" rel="ugc">@<span>#{user2.nickname}</span></a></span>)      end      test "updates the user's locking status", %{conn: conn} do @@ -334,7 +333,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do        assert account["fields"] == [                 %{"name" => "foo", "value" => "bar"}, -               %{"name" => "link", "value" => "<a href=\"http://cofe.io\">cofe.io</a>"} +               %{"name" => "link", "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)}               ]        assert account["source"]["fields"] == [ diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 35a0d3fe1..73a3bf135 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -97,6 +97,22 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do             |> json_response(403) == %{"error" => "This resource requires authentication."}    end +  test "the public timeline includes only public statuses for an authenticated user" do +    user = insert(:user) + +    conn = +      build_conn() +      |> assign(:user, user) + +    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test"}) +    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "private"}) +    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "unlisted"}) +    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "direct"}) + +    res_conn = get(conn, "/api/v1/timelines/public") +    assert length(json_response(res_conn, 200)) == 1 +  end +    describe "posting statuses" do      setup do        user = insert(:user) @@ -998,9 +1014,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do          |> get("/api/v1/notifications")        expected_response = -        "hi <span class=\"h-card\"><a data-user=\"#{user.id}\" class=\"u-url mention\" href=\"#{ +        ~s(hi <span class="h-card"><a data-user="#{user.id}" class="u-url mention" href="#{            user.ap_id -        }\">@<span>#{user.nickname}</span></a></span>" +        }" rel="ugc">@<span>#{user.nickname}</span></a></span>)        assert [%{"status" => %{"content" => response}} | _rest] = json_response(conn, 200)        assert response == expected_response @@ -1020,9 +1036,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do          |> get("/api/v1/notifications/#{notification.id}")        expected_response = -        "hi <span class=\"h-card\"><a data-user=\"#{user.id}\" class=\"u-url mention\" href=\"#{ +        ~s(hi <span class="h-card"><a data-user="#{user.id}" class="u-url mention" href="#{            user.ap_id -        }\">@<span>#{user.nickname}</span></a></span>" +        }" rel="ugc">@<span>#{user.nickname}</span></a></span>)        assert %{"status" => %{"content" => response}} = json_response(conn, 200)        assert response == expected_response | 
