Skip to content

Commit

Permalink
Client.search: Add tests checking kwargs search
Browse files Browse the repository at this point in the history
Add tests and corresponding fixtures to proof that passing keyword arguments
(**fields) is working.
  • Loading branch information
JOJ0 committed May 17, 2022
1 parent 05a87fb commit 1664225
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pagination": {"per_page": 50, "pages": 1, "page": 1, "urls": {}, "items": 13}, "results": [{"thumb": null, "title": "Trash80", "uri": "/artist/Trash80", "resource_url": "/artists/95780", "type": "artist", "id": 95780}, {"style": ["Electro", "Chiptune"], "thumb": "/image/R-90-1743771-1272253277.gif", "title": "Trash80 - Icarus", "country": "US", "format": ["CDr"], "uri": "/Trash80-Icarus/release/1743771", "label": "8bitpeoples", "catno": "8BP086", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1743771", "type": "release", "id": 1743771}, {"style": ["Electro", "Chiptune"], "thumb": "/image/R-90-1346442-1211545307.gif", "title": "Trash80 - Icarus", "country": "US", "format": ["File"], "uri": "/Trash80-Icarus/release/1346442", "label": "8bitpeoples", "catno": "8BP086", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1346442", "type": "release", "id": 1346442}, {"style": ["Chiptune"], "thumb": "/image/R-90-480740-1149028432.gif", "title": "Trash80 - Hologram", "country": "US", "format": ["File"], "uri": "/Trash80-Hologram/release/480740", "label": "8bitpeoples", "catno": "8BP037", "year": "2003", "genre": ["Electronic"], "resource_url": "/releases/480740", "type": "release", "id": 480740}, {"style": ["Modern Classical", "Chiptune", "Breaks", "Ambient"], "thumb": "/image/R-90-3329867-1326034108.jpeg", "title": "Trash80 & Dma-Sc - Darwinia Soundtrack", "country": "UK", "format": ["File"], "uri": "/Trash80-Dma-Sc-Darwinia-Soundtrack/release/3329867", "label": "Not On Label", "catno": "none", "year": "2005", "genre": ["Electronic"], "resource_url": "/releases/3329867", "type": "release", "id": 3329867}, {"style": ["Chiptune"], "thumb": "/image/R-90-1554401-1227991910.gif", "title": "Nullsleep - Unconditional Acceleration", "country": "US", "format": ["File"], "uri": "/Nullsleep-Unconditional-Acceleration/release/1554401", "label": "8bitpeoples", "catno": "8BP088", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1554401", "type": "release", "id": 1554401}, {"style": ["Chiptune"], "thumb": "/image/R-90-2634760-1294296299.gif", "title": "Sievert - Chips, Dips And Facerips", "country": "US", "format": ["File"], "uri": "/Sievert-Chips-Dips-And-Facerips/release/2634760", "label": "8bitpeoples", "catno": "8BP113", "year": "2011", "genre": ["Electronic"], "resource_url": "/releases/2634760", "type": "release", "id": 2634760}, {"style": ["Chiptune"], "thumb": "/image/R-90-1554411-1228435569.jpeg", "title": "Minusbaby - Saudade For Beginners", "country": "US", "format": ["File", "CD"], "uri": "/Minusbaby-Saudade-For-Beginners/release/1554411", "label": "8bitpeoples", "catno": "8BP089", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1554411", "type": "release", "id": 1554411}, {"style": ["Abstract", "Musique Concr\u00e8te", "Experimental"], "thumb": null, "title": "Larry Wendt - Sound Poems For An Era Of Reduced Expectations", "country": "US", "format": ["Cassette"], "uri": "/Larry-Wendt-Sound-Poems-For-An-Era-Of-Reduced-Expectations/release/2674683", "label": "Underwhich Audiographics", "catno": "5", "genre": ["Electronic", "Non-Music"], "resource_url": "/releases/2674683", "type": "release", "id": 2674683}, {"style": ["Breakbeat", "Interview", "Techno", "IDM", "Minimal"], "thumb": null, "title": "Datamat - Interjamp Realaudio Special", "country": "Germany", "format": ["File"], "uri": "/Datamat-Interjamp-Realaudio-Special/release/1994383", "label": "Interjamp Radio", "catno": "inter004", "year": "2004", "genre": ["Electronic", "Non-Music"], "resource_url": "/releases/1994383", "type": "release", "id": 1994383}, {"style": ["IDM", "Noise", "Experimental"], "thumb": "/image/R-90-132406-1177641432.jpeg", "title": "Various - One Minute Massacre Volume 1", "country": "", "format": ["CD"], "uri": "/Various-One-Minute-Massacre-Volume-1/release/132406", "label": "Soulseek Records", "catno": "SLSK002", "year": "2003", "genre": ["Electronic"], "resource_url": "/releases/132406", "type": "release", "id": 132406}, {"style": ["Chiptune", "Experimental"], "thumb": "/image/R-90-915735-1229262615.jpeg", "title": "Various - 8BP050", "country": "US", "format": ["CD", "File"], "uri": "/Various-8BP050/release/915735", "label": "8bitpeoples", "catno": "8BP050", "year": "2006", "genre": ["Electronic"], "resource_url": "/releases/915735", "type": "release", "id": 915735}, {"style": ["Electro", "Chiptune"], "thumb": "/image/R-90-1903567-1251600832.jpeg", "title": "Various - Blip Festival 2008: 32 Live Recordings", "country": "US", "format": ["CD"], "uri": "/Various-Blip-Festival-2008-32-Live-Recordings/release/1903567", "label": "8bitpeoples", "catno": "8BP100", "year": "2009", "genre": ["Electronic"], "resource_url": "/releases/1903567", "type": "release", "id": 1903567}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pagination": {"per_page": 50, "pages": 1, "page": 1, "urls": {}, "items": 13}, "results": [{"thumb": null, "title": "Trash80", "uri": "/artist/Trash80", "resource_url": "/artists/95780", "type": "artist", "id": 95780}, {"style": ["Electro", "Chiptune"], "thumb": "/image/R-90-1743771-1272253277.gif", "title": "Trash80 - Icarus", "country": "US", "format": ["CDr"], "uri": "/Trash80-Icarus/release/1743771", "label": "8bitpeoples", "catno": "8BP086", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1743771", "type": "release", "id": 1743771}, {"style": ["Electro", "Chiptune"], "thumb": "/image/R-90-1346442-1211545307.gif", "title": "Trash80 - Icarus", "country": "US", "format": ["File"], "uri": "/Trash80-Icarus/release/1346442", "label": "8bitpeoples", "catno": "8BP086", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1346442", "type": "release", "id": 1346442}, {"style": ["Chiptune"], "thumb": "/image/R-90-480740-1149028432.gif", "title": "Trash80 - Hologram", "country": "US", "format": ["File"], "uri": "/Trash80-Hologram/release/480740", "label": "8bitpeoples", "catno": "8BP037", "year": "2003", "genre": ["Electronic"], "resource_url": "/releases/480740", "type": "release", "id": 480740}, {"style": ["Modern Classical", "Chiptune", "Breaks", "Ambient"], "thumb": "/image/R-90-3329867-1326034108.jpeg", "title": "Trash80 & Dma-Sc - Darwinia Soundtrack", "country": "UK", "format": ["File"], "uri": "/Trash80-Dma-Sc-Darwinia-Soundtrack/release/3329867", "label": "Not On Label", "catno": "none", "year": "2005", "genre": ["Electronic"], "resource_url": "/releases/3329867", "type": "release", "id": 3329867}, {"style": ["Chiptune"], "thumb": "/image/R-90-1554401-1227991910.gif", "title": "Nullsleep - Unconditional Acceleration", "country": "US", "format": ["File"], "uri": "/Nullsleep-Unconditional-Acceleration/release/1554401", "label": "8bitpeoples", "catno": "8BP088", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1554401", "type": "release", "id": 1554401}, {"style": ["Chiptune"], "thumb": "/image/R-90-2634760-1294296299.gif", "title": "Sievert - Chips, Dips And Facerips", "country": "US", "format": ["File"], "uri": "/Sievert-Chips-Dips-And-Facerips/release/2634760", "label": "8bitpeoples", "catno": "8BP113", "year": "2011", "genre": ["Electronic"], "resource_url": "/releases/2634760", "type": "release", "id": 2634760}, {"style": ["Chiptune"], "thumb": "/image/R-90-1554411-1228435569.jpeg", "title": "Minusbaby - Saudade For Beginners", "country": "US", "format": ["File", "CD"], "uri": "/Minusbaby-Saudade-For-Beginners/release/1554411", "label": "8bitpeoples", "catno": "8BP089", "year": "2008", "genre": ["Electronic"], "resource_url": "/releases/1554411", "type": "release", "id": 1554411}, {"style": ["Abstract", "Musique Concr\u00e8te", "Experimental"], "thumb": null, "title": "Larry Wendt - Sound Poems For An Era Of Reduced Expectations", "country": "US", "format": ["Cassette"], "uri": "/Larry-Wendt-Sound-Poems-For-An-Era-Of-Reduced-Expectations/release/2674683", "label": "Underwhich Audiographics", "catno": "5", "genre": ["Electronic", "Non-Music"], "resource_url": "/releases/2674683", "type": "release", "id": 2674683}, {"style": ["Breakbeat", "Interview", "Techno", "IDM", "Minimal"], "thumb": null, "title": "Datamat - Interjamp Realaudio Special", "country": "Germany", "format": ["File"], "uri": "/Datamat-Interjamp-Realaudio-Special/release/1994383", "label": "Interjamp Radio", "catno": "inter004", "year": "2004", "genre": ["Electronic", "Non-Music"], "resource_url": "/releases/1994383", "type": "release", "id": 1994383}, {"style": ["IDM", "Noise", "Experimental"], "thumb": "/image/R-90-132406-1177641432.jpeg", "title": "Various - One Minute Massacre Volume 1", "country": "", "format": ["CD"], "uri": "/Various-One-Minute-Massacre-Volume-1/release/132406", "label": "Soulseek Records", "catno": "SLSK002", "year": "2003", "genre": ["Electronic"], "resource_url": "/releases/132406", "type": "release", "id": 132406}, {"style": ["Chiptune", "Experimental"], "thumb": "/image/R-90-915735-1229262615.jpeg", "title": "Various - 8BP050", "country": "US", "format": ["CD", "File"], "uri": "/Various-8BP050/release/915735", "label": "8bitpeoples", "catno": "8BP050", "year": "2006", "genre": ["Electronic"], "resource_url": "/releases/915735", "type": "release", "id": 915735}, {"style": ["Electro", "Chiptune"], "thumb": "/image/R-90-1903567-1251600832.jpeg", "title": "Various - Blip Festival 2008: 32 Live Recordings", "country": "US", "format": ["CD"], "uri": "/Various-Blip-Festival-2008-32-Live-Recordings/release/1903567", "label": "8bitpeoples", "catno": "8BP100", "year": "2009", "genre": ["Electronic"], "resource_url": "/releases/1903567", "type": "release", "id": 1903567}]}
12 changes: 12 additions & 0 deletions discogs_client/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ def test_multiterm_mixed_search(self):
self.assertTrue(isinstance(results[0], Artist))
self.assertTrue(isinstance(results[1], Release))

def test_kwargs_search(self):
results = self.d.search(artist='trash80')
self.assertEqual(len(results), 13)
self.assertTrue(isinstance(results[0], Artist))
self.assertTrue(isinstance(results[1], Release))

def test_kwargs_multiterm_search(self):
results = self.d.search(title='icarus', artist='trash80')
self.assertEqual(len(results), 13)
self.assertTrue(isinstance(results[0], Artist))
self.assertTrue(isinstance(results[1], Release))

def test_utf8_search(self):
uni_string = 'caf\xe9'
try:
Expand Down

0 comments on commit 1664225

Please sign in to comment.