From c33d297f5cda4a34ed9979da37f1b4dbd5209548 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sat, 13 Jul 2019 17:52:05 +0200
Subject: [PATCH] Can now delete uploads

---
 funkwhale_cli/cli/uploads.py |  3 +++
 tests/test_cli.py            | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/funkwhale_cli/cli/uploads.py b/funkwhale_cli/cli/uploads.py
index 4c1bf39..5e803b8 100644
--- a/funkwhale_cli/cli/uploads.py
+++ b/funkwhale_cli/cli/uploads.py
@@ -91,3 +91,6 @@ async def uploads_create(ctx, library_id, paths, ref, parallel):
         ]
         await asyncio.gather(*tasks)
         logs.logger.info("Upload complete")
+
+
+uploads_rm = base.get_delete_command(uploads, "api/v1/uploads/{}/")
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 8ebd061..5d66cc7 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -223,6 +223,20 @@ def test_uploads_ls(cli_ctx, session, responses, get_requests):
     assert len(requests) == 1
 
 
+def test_uploads_rm(cli_ctx, session, responses, get_requests):
+    uuid1 = str(uuid.uuid4())
+    uuid2 = str(uuid.uuid4())
+    command = cli.uploads.uploads_rm
+    url = "https://test.funkwhale/api/v1/uploads/"
+    responses.delete(url + uuid1 + "/")
+    responses.delete(url + uuid2 + "/")
+
+    command.callback(id=[uuid1, uuid2], raw=False, no_input=True, _async_reraise=True)
+
+    assert len(get_requests("delete", url + uuid1 + "/")) == 1
+    assert len(get_requests("delete", url + uuid2 + "/")) == 1
+
+
 def test_favorites_tracks_create(cli_ctx, session, responses, get_requests):
     command = cli.favorites.favorites_tracks_create
     url = "https://test.funkwhale/api/v1/favorites/tracks/"
-- 
GitLab