From d6348a4da25f167308f5f7cd4573ab6ff4cce2b2 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 13 May 2015 18:09:35 -0700 Subject: [PATCH] tests: Use bytes for mock responses Also, require a newer version of responses that is less sensitive to this. --- test/test_art.py | 8 ++++---- tox.ini | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_art.py b/test/test_art.py index c7476f52f..9825a4bc7 100644 --- a/test/test_art.py +++ b/test/test_art.py @@ -203,7 +203,7 @@ class AAOTest(_common.TestCase): match_querystring=True) def test_aao_scraper_finds_image(self): - body = """ + body = b"""
@@ -216,7 +216,7 @@ class AAOTest(_common.TestCase): self.assertEqual(list(res)[0], 'TARGET_URL') def test_aao_scraper_returns_no_result_when_no_image_present(self): - self.mock_response(self.AAO_URL, 'blah blah') + self.mock_response(self.AAO_URL, b'blah blah') album = _common.Bag(asin=self.ASIN) res = self.source.get(album) self.assertEqual(list(res), []) @@ -240,7 +240,7 @@ class GoogleImageTest(_common.TestCase): def test_google_art_finds_image(self): album = _common.Bag(albumartist="some artist", album="some album") - json = """{"responseData": {"results": + json = b"""{"responseData": {"results": [{"unescapedUrl": "url_to_the_image"}]}}""" self.mock_response(self._google_url, json) result_url = self.source.get(album) @@ -248,7 +248,7 @@ class GoogleImageTest(_common.TestCase): def test_google_art_dont_finds_image(self): album = _common.Bag(albumartist="some artist", album="some album") - json = """bla blup""" + json = b"""bla blup""" self.mock_response(self._google_url, json) result_url = self.source.get(album) self.assertEqual(list(result_url), []) diff --git a/tox.ini b/tox.ini index be8862d42..aaa25a01c 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ deps = pyechonest pylast rarfile - responses + responses>=0.3.0 pathlib pyxdg jellyfish