X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fpleroma_api%2Fcontrollers%2Fscrobble_controller_test.exs;h=f39c07ac649ea52986a477c3c728dcd13680a33e;hb=9b6d89ff8c798079f4db18eb2b5c66a7426ecbc5;hp=2242610f15db39a8199bd825366fe3eb9b944ef6;hpb=455e072d27f28c39050b2dc24b346a8f2ef30f90;p=akkoma
diff --git a/test/web/pleroma_api/controllers/scrobble_controller_test.exs b/test/web/pleroma_api/controllers/scrobble_controller_test.exs
index 2242610f1..f39c07ac6 100644
--- a/test/web/pleroma_api/controllers/scrobble_controller_test.exs
+++ b/test/web/pleroma_api/controllers/scrobble_controller_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do
@@ -12,14 +12,16 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do
%{conn: conn} = oauth_access(["write"])
conn =
- post(conn, "/api/v1/pleroma/scrobble", %{
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("/api/v1/pleroma/scrobble", %{
"title" => "lain radio episode 1",
"artist" => "lain",
"album" => "lain radio",
"length" => "180000"
})
- assert %{"title" => "lain radio episode 1"} = json_response(conn, 200)
+ assert %{"title" => "lain radio episode 1"} = json_response_and_validate_schema(conn, 200)
end
end
@@ -29,28 +31,28 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do
{:ok, _activity} =
CommonAPI.listen(user, %{
- "title" => "lain radio episode 1",
- "artist" => "lain",
- "album" => "lain radio"
+ title: "lain radio episode 1",
+ artist: "lain",
+ album: "lain radio"
})
{:ok, _activity} =
CommonAPI.listen(user, %{
- "title" => "lain radio episode 2",
- "artist" => "lain",
- "album" => "lain radio"
+ title: "lain radio episode 2",
+ artist: "lain",
+ album: "lain radio"
})
{:ok, _activity} =
CommonAPI.listen(user, %{
- "title" => "lain radio episode 3",
- "artist" => "lain",
- "album" => "lain radio"
+ title: "lain radio episode 3",
+ artist: "lain",
+ album: "lain radio"
})
conn = get(conn, "/api/v1/pleroma/accounts/#{user.id}/scrobbles")
- result = json_response(conn, 200)
+ result = json_response_and_validate_schema(conn, 200)
assert length(result) == 3
end