diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-09-09 13:56:51 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-09-09 13:56:51 +0200 |
commit | 4dc517a0bb979793c1c2590d38efe853c68eb80c (patch) | |
tree | d0883d6913b95745c3890d0e94026392483ba391 /test | |
parent | be04f725e9398ebde446ef5664d4dbedd1eb262b (diff) | |
download | pleroma-4dc517a0bb979793c1c2590d38efe853c68eb80c.tar.gz pleroma-4dc517a0bb979793c1c2590d38efe853c68eb80c.zip |
Add deletion to masto api.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index a3692c9a0..d781af675 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -93,4 +93,32 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert %{"id" => id} = json_response(conn, 200) assert id == activity.id end + + describe "deleting a status" do + test "when you created it", %{conn: conn} do + activity = insert(:note_activity) + author = User.get_by_ap_id(activity.data["actor"]) + + conn = conn + |> assign(:user, author) + |> delete("/api/v1/statuses/#{activity.id}") + + assert %{} = json_response(conn, 200) + + assert Repo.get(Activity, activity.id) == nil + end + + test "when you didn't create it", %{conn: conn} do + activity = insert(:note_activity) + user = insert(:user) + + conn = conn + |> assign(:user, user) + |> delete("/api/v1/statuses/#{activity.id}") + + assert %{"error" => _} = json_response(conn, 403) + + assert Repo.get(Activity, activity.id) == activity + end + end end |