From 3025d17cbe8ae2e4a300c2e345a750f352cb6d52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= <sporiff@funkwhale.audio>
Date: Mon, 26 Sep 2022 10:32:57 +0200
Subject: [PATCH] Add more tests

---
 tests/data/library_follow_request.json        |  3 +
 tests/data/paginated_api_mutation_list.json   | 83 +++++++++++++++++++
 tests/data/paginated_application_list.json    | 23 +++++
 .../unit/test_model_library_follow_request.py |  8 ++
 .../test_model_paginated_api_mutation_list.py |  8 ++
 .../test_model_paginated_application_list.py  |  8 ++
 6 files changed, 133 insertions(+)
 create mode 100644 tests/data/library_follow_request.json
 create mode 100644 tests/data/paginated_api_mutation_list.json
 create mode 100644 tests/data/paginated_application_list.json
 create mode 100644 tests/unit/test_model_library_follow_request.py
 create mode 100644 tests/unit/test_model_paginated_api_mutation_list.py
 create mode 100644 tests/unit/test_model_paginated_application_list.py

diff --git a/tests/data/library_follow_request.json b/tests/data/library_follow_request.json
new file mode 100644
index 0000000..3d44fa1
--- /dev/null
+++ b/tests/data/library_follow_request.json
@@ -0,0 +1,3 @@
+{
+   "target": "a713f619-6a62-4aff-ad73-66c791920108"
+}
\ No newline at end of file
diff --git a/tests/data/paginated_api_mutation_list.json b/tests/data/paginated_api_mutation_list.json
new file mode 100644
index 0000000..b409a8d
--- /dev/null
+++ b/tests/data/paginated_api_mutation_list.json
@@ -0,0 +1,83 @@
+{
+   "count": 1132,
+   "next": "https://tanukitunes.com/api/v1/mutations?ordering=creation_date&page=2&page_size=2",
+   "previous": null,
+   "results": [
+      {
+         "fid": "https://tanukitunes.com/federation/edits/e272f41a-c2af-434e-a6c1-4c348ec6f96d",
+         "uuid": "e272f41a-c2af-434e-a6c1-4c348ec6f96d",
+         "type": "update",
+         "creation_date": "2019-05-05T22:05:26.883622Z",
+         "applied_date": "2019-05-05T22:05:26.944001Z",
+         "is_approved": true,
+         "is_applied": true,
+         "created_by": {
+            "fid": "https://tanukitunes.com/federation/actors/doctorworm",
+            "url": null,
+            "creation_date": "2018-12-12T22:12:18Z",
+            "summary": null,
+            "preferred_username": "doctorworm",
+            "name": "doctorworm",
+            "last_fetch_date": "2021-06-13T14:13:41Z",
+            "domain": "tanukitunes.com",
+            "type": "Person",
+            "manually_approves_followers": false,
+            "full_username": "doctorworm@tanukitunes.com",
+            "is_local": true
+         },
+         "approved_by": null,
+         "summary": "Added CCBYA3",
+         "payload": {
+            "license": "cc-by-3.0"
+         },
+         "previous_state": {
+            "license": {
+               "value": null
+            }
+         },
+         "target": {
+            "type": "track",
+            "id": 1,
+            "repr": "Kowloon City"
+         }
+      },
+      {
+         "fid": "https://tanukitunes.com/federation/edits/c7ff3f86-5573-4f0b-89e6-8df9be9e6edd",
+         "uuid": "c7ff3f86-5573-4f0b-89e6-8df9be9e6edd",
+         "type": "update",
+         "creation_date": "2019-05-05T22:05:54.152095Z",
+         "applied_date": "2019-05-05T22:05:54.192031Z",
+         "is_approved": true,
+         "is_applied": true,
+         "created_by": {
+            "fid": "https://tanukitunes.com/federation/actors/doctorworm",
+            "url": null,
+            "creation_date": "2018-12-12T22:12:18Z",
+            "summary": null,
+            "preferred_username": "doctorworm",
+            "name": "doctorworm",
+            "last_fetch_date": "2021-06-13T14:13:41Z",
+            "domain": "tanukitunes.com",
+            "type": "Person",
+            "manually_approves_followers": false,
+            "full_username": "doctorworm@tanukitunes.com",
+            "is_local": true
+         },
+         "approved_by": null,
+         "summary": "Added CCBYA3",
+         "payload": {
+            "license": "cc-by-3.0"
+         },
+         "previous_state": {
+            "license": {
+               "value": null
+            }
+         },
+         "target": {
+            "type": "track",
+            "id": 2,
+            "repr": "The Rain Over Hong Kong"
+         }
+      }
+   ]
+}
\ No newline at end of file
diff --git a/tests/data/paginated_application_list.json b/tests/data/paginated_application_list.json
new file mode 100644
index 0000000..5716891
--- /dev/null
+++ b/tests/data/paginated_application_list.json
@@ -0,0 +1,23 @@
+{
+   "count": 2,
+   "next": null,
+   "previous": null,
+   "results": [
+      {
+         "client_id": "0bxRvjIMbZUYBJH39cJ1j7MBjo0R71axG8cZdYxm",
+         "name": "Swagger",
+         "scopes": "read",
+         "created": "2022-07-18T20:12:20.390955Z",
+         "updated": "2022-07-18T20:23:08.641340Z",
+         "token": "very-authentic-definitely-real-token"
+      },
+      {
+         "client_id": "bVRCxF7F570FGgHRWWGL1JTQiH2KyRereE6tmihp",
+         "name": "Funkwhale CLI",
+         "scopes": "read",
+         "created": "2022-06-17T14:32:36.572114Z",
+         "updated": "2022-06-17T14:32:36.572136Z",
+         "token": "another-authentic-definitely-real-token"
+      }
+   ]
+}
\ No newline at end of file
diff --git a/tests/unit/test_model_library_follow_request.py b/tests/unit/test_model_library_follow_request.py
new file mode 100644
index 0000000..662a960
--- /dev/null
+++ b/tests/unit/test_model_library_follow_request.py
@@ -0,0 +1,8 @@
+import json
+from funkwhale_api_client.models.library_follow_request import LibraryFollowRequest
+
+def test_LibraryFollowRequest(load_data):
+   response = load_data("library_follow_request")
+   follow_request : LibraryFollowRequest = LibraryFollowRequest.from_dict(response)
+
+   assert isinstance(follow_request, LibraryFollowRequest)
\ No newline at end of file
diff --git a/tests/unit/test_model_paginated_api_mutation_list.py b/tests/unit/test_model_paginated_api_mutation_list.py
new file mode 100644
index 0000000..6982419
--- /dev/null
+++ b/tests/unit/test_model_paginated_api_mutation_list.py
@@ -0,0 +1,8 @@
+import json
+from funkwhale_api_client.models.paginated_api_mutation_list import PaginatedAPIMutationList
+
+def test_PaginatedAPIMutationList(load_data):
+   response = load_data("paginated_api_mutation_list")
+   mutation_list : PaginatedAPIMutationList = PaginatedAPIMutationList.from_dict(response)
+
+   assert isinstance(mutation_list, PaginatedAPIMutationList)
\ No newline at end of file
diff --git a/tests/unit/test_model_paginated_application_list.py b/tests/unit/test_model_paginated_application_list.py
new file mode 100644
index 0000000..c6049fa
--- /dev/null
+++ b/tests/unit/test_model_paginated_application_list.py
@@ -0,0 +1,8 @@
+import json
+from funkwhale_api_client.models.paginated_application_list import PaginatedApplicationList
+
+def test_PaginatedApplicationList(load_data):
+   response = load_data("paginated_application_list")
+   application_list : PaginatedApplicationList = PaginatedApplicationList.from_dict(response)
+
+   assert isinstance(application_list, PaginatedApplicationList)
\ No newline at end of file
-- 
GitLab