1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do
6 use Pleroma.Web.ConnCase
8 alias Pleroma.Web.CommonAPI
11 describe "POST /api/v1/pleroma/scrobble" do
12 test "works correctly", %{conn: conn} do
17 |> assign(:user, user)
18 |> post("/api/v1/pleroma/scrobble", %{
19 "title" => "lain radio episode 1",
21 "album" => "lain radio",
25 assert %{"title" => "lain radio episode 1"} = json_response(conn, 200)
29 describe "GET /api/v1/pleroma/accounts/:id/scrobbles" do
30 test "works correctly", %{conn: conn} do
34 CommonAPI.listen(user, %{
35 "title" => "lain radio episode 1",
37 "album" => "lain radio"
41 CommonAPI.listen(user, %{
42 "title" => "lain radio episode 2",
44 "album" => "lain radio"
48 CommonAPI.listen(user, %{
49 "title" => "lain radio episode 3",
51 "album" => "lain radio"
56 |> get("/api/v1/pleroma/accounts/#{user.id}/scrobbles")
58 result = json_response(conn, 200)
60 assert length(result) == 3