| 58 | |
| 59 | @responses.activate |
| 60 | def test_missing_request(self): |
| 61 | json_file = os.path.join( |
| 62 | _common.RSRC, b"spotify", b"missing_request.json" |
| 63 | ) |
| 64 | with open(json_file, "rb") as f: |
| 65 | response_body = f.read() |
| 66 | |
| 67 | responses.add( |
| 68 | responses.GET, |
| 69 | spotify.SpotifyPlugin.search_url, |
| 70 | body=response_body, |
| 71 | status=200, |
| 72 | content_type="application/json", |
| 73 | ) |
| 74 | item = Item( |
| 75 | mb_trackid="01234", |
| 76 | album="lkajsdflakjsd", |
| 77 | albumartist="ujydfsuihse", |
| 78 | title="duifhjslkef", |
| 79 | length=10, |
| 80 | ) |
| 81 | item.add(self.lib) |
| 82 | assert [] == self.spotify._match_library_tracks(self.lib, "") |
| 83 | |
| 84 | params = _params(responses.calls[0].request.url) |
| 85 | query = params["q"][0] |
| 86 | assert "duifhjslkef" in query |
| 87 | assert "artist:'ujydfsuihse'" in query |
| 88 | assert "album:'lkajsdflakjsd'" in query |
| 89 | assert params["type"] == ["track"] |
| 90 | |
| 91 | @responses.activate |
| 92 | def test_track_request(self): |