Coverage for api/examples/audio_responses.py: 100%
13 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 06:14 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 06:14 +0000
1from api.examples.environment import ORIGIN
4identifier = "8624ba61-57f1-4f98-8a85-ece206c319cf"
6base_audio = {
7 "id": identifier,
8 "title": "Wish You Were Here",
9 "indexed_on": "2022-12-06T06:54:25Z",
10 "foreign_landing_url": "https://www.jamendo.com/track/1214935",
11 "url": "https://mp3d.jamendo.com/download/track/1214935/mp32",
12 "creator": "The.madpix.project",
13 "creator_url": "https://www.jamendo.com/artist/441585/the.madpix.project",
14 "license": "by-nc-sa",
15 "license_version": "3.0",
16 "license_url": "https://creativecommons.org/licenses/by-nc-sa/3.0/",
17 "provider": "jamendo",
18 "source": "jamendo",
19 "category": "music",
20 "genres": ["dance", "electronic", "house"],
21 "filesize": 7139840,
22 "filetype": "mp3",
23 "tags": [
24 {"accuracy": None, "name": "vocal", "unstable__provider": "jamendo"},
25 {"accuracy": None, "name": "female", "unstable__provider": "jamendo"},
26 {"accuracy": None, "name": "speed_medium", "unstable__provider": "jamendo"},
27 {"accuracy": None, "name": "guitar", "unstable__provider": "jamendo"},
28 {"accuracy": None, "name": "strings", "unstable__provider": "jamendo"},
29 {"accuracy": None, "name": "energetic", "unstable__provider": "jamendo"},
30 {"accuracy": None, "name": "acoustic", "unstable__provider": "jamendo"},
31 {"accuracy": None, "name": "vocal", "unstable__provider": "jamendo"},
32 {"accuracy": None, "name": "voice", "unstable__provider": "jamendo"},
33 {"accuracy": None, "name": "funkyhouse", "unstable__provider": "jamendo"},
34 ],
35 "alt_files": None,
36 "attribution": '"Wish You Were Here" by The.madpix.project is licensed under CC BY-NC-SA 3.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/.', # noqa: E501,
37 "fields_matched": [],
38 "mature": False,
39 "audio_set": {
40 "title": "Wish You Were Here",
41 "foreign_landing_url": "https://www.jamendo.com/album/145774/wish-you-were-here", # noqa: E501
42 "creator": "The.madpix.project",
43 "creator_url": "https://www.jamendo.com/artist/441585/the.madpix.project",
44 "url": "https://usercontent.jamendo.com?type=album&id=145774&width=200",
45 "filesize": None,
46 "filetype": None,
47 },
48 "duration": 270000,
49 "bit_rate": 128000,
50 "sample_rate": 44100,
51 "thumbnail": f"{ORIGIN}/v1/audio/{identifier}/thumb/",
52 "detail_url": f"{ORIGIN}/v1/audio/{identifier}/",
53 "related_url": f"{ORIGIN}/v1/audio/{identifier}/related/",
54 "waveform": f"{ORIGIN}/v1/audio/{identifier}/waveform/",
55 "unstable__sensitivity": [],
56}
58audio_search_200_example = {
59 "result_count": 1,
60 "page_count": 1,
61 "page_size": 20,
62 "page": 1,
63 "results": [
64 base_audio | {"fields_matched": ["title"]},
65 ],
66}
68audio_search_400_example = {
69 "error": "InputError",
70 "detail": "Invalid input given for fields. 'license' -> License 'PDMNBCG' does not exist.", # noqa: E501
71 "fields": ["license"],
72}
74audio_stats_200_example = [
75 {
76 "source_name": "freesound",
77 "display_name": "Freesound",
78 "source_url": "https://freesound.org/",
79 "logo_url": None,
80 "media_count": 827,
81 },
82 {
83 "source_name": "jamendo",
84 "display_name": "Jamendo",
85 "source_url": "https://www.jamendo.com",
86 "logo_url": None,
87 "media_count": 180,
88 },
89 {
90 "source_name": "wikimedia_audio",
91 "display_name": "Wikimedia",
92 "source_url": "https://commons.wikimedia.org",
93 "logo_url": None,
94 "media_count": 3992,
95 },
96 {
97 "display_name": "CCMixter",
98 "logo_url": None,
99 "media_count": 1,
100 "source_name": "ccmixter",
101 "source_url": "https://ccmixter.org",
102 },
103]
105audio_detail_200_example = base_audio
107audio_detail_404_example = {"detail": "Not found."}
109audio_related_200_example = {
110 "result_count": 1,
111 "page_count": 1,
112 "page_size": 20,
113 "page": 1,
114 "results": [
115 {
116 "title": "File:Mozart - Eine kleine Nachtmusik - 1. Allegro.ogg",
117 "id": "36537842-b067-4ca0-ad67-e00ff2e06b2e",
118 "creator": "Wolfgang Amadeus Mozart",
119 "creator_url": "https://en.wikipedia.org/wiki/Wolfgang_Amadeus_Mozart",
120 "url": "https://upload.wikimedia.org/wikipedia/commons/2/24/Mozart_-_Eine_kleine_Nachtmusik_-_1._Allegro.ogg", # noqa: E501
121 "provider": "wikimedia",
122 "source": "wikimedia",
123 "license": "by-sa",
124 "license_version": "2.0",
125 "license_url": "https://creativecommons.org/licenses/by-sa/2.0/",
126 "foreign_landing_url": "https://commons.wikimedia.org/w/index.php?curid=3536953", # noqa: E501
127 "detail_url": f"{ORIGIN}/v1/audio/36537842-b067-4ca0-ad67-e00ff2e06b2e", # noqa: E501
128 "related_url": f"{ORIGIN}/v1/recommendations/audio/36537842-b067-4ca0-ad67-e00ff2e06b2e", # noqa: E501
129 "fields_matched": ["description", "title"],
130 "tags": [{"name": "exam"}, {"name": "tactics"}],
131 }
132 ],
133}
135audio_related_404_example = {"detail": "An internal server error occurred."}
137audio_complain_201_example = {
138 "identifier": identifier,
139 "reason": "mature",
140 "description": "This audio contains sensitive content",
141}
143audio_waveform_200_example = {
144 "len": 1083,
145 "points": [
146 0.61275,
147 0.19593,
148 0.74023,
149 # 1077 more entries
150 0.00089,
151 0.00043,
152 0.00049,
153 ],
154}
156audio_waveform_404_example = {"detail": "An internal server error occurred."}