diff options
author | lambda <pleromagit@rogerbraun.net> | 2017-11-14 14:09:36 +0000 |
---|---|---|
committer | lambda <pleromagit@rogerbraun.net> | 2017-11-14 14:09:36 +0000 |
commit | dd76036cbb8c77aaaeb9d6c9b55df41658046e16 (patch) | |
tree | f2f3822f46dc9882695cd40d14383418db7bfe3e /test | |
parent | 773eba4f0bb6151158285f7985e46958dcbd1b9d (diff) | |
parent | 06c3ee3bac9abe5a369364743143618c473eb7a9 (diff) | |
download | pleroma-dd76036cbb8c77aaaeb9d6c9b55df41658046e16.tar.gz pleroma-dd76036cbb8c77aaaeb9d6c9b55df41658046e16.zip |
Merge branch 'mastoapi-media-timeline' into 'develop'
MastoAPI: Add media timelines.
Closes #63
See merge request pleroma/pleroma!16
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 23 |
1 files changed, 23 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 25d92d010..a00a11f8b 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -249,6 +249,29 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert id == to_string(note_two.id) end + + test "gets an users media", %{conn: conn} do + note = insert(:note_activity) + user = User.get_by_ap_id(note.data["actor"]) + + file = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"} + media = TwitterAPI.upload(file, "json") + |> Poison.decode! + + {:ok, image_post} = TwitterAPI.create_status(user, %{"status" => "cofe", "media_ids" => [media["media_id"]]}) + + conn = conn + |> get("/api/v1/accounts/#{user.id}/statuses", %{"only_media" => "true"}) + + assert [%{"id" => id}] = json_response(conn, 200) + assert id == to_string(image_post.id) + + conn = build_conn() + |> get("/api/v1/accounts/#{user.id}/statuses", %{"only_media" => "1"}) + + assert [%{"id" => id}] = json_response(conn, 200) + assert id == to_string(image_post.id) + end end describe "user relationships" do |