tests: Use bytes for mock responses

Also, require a newer version of responses that is less sensitive to this.
This commit is contained in:
Adrian Sampson 2015-05-13 18:09:35 -07:00
parent 71d7c0b004
commit d6348a4da2
2 changed files with 5 additions and 5 deletions

View file

@ -203,7 +203,7 @@ class AAOTest(_common.TestCase):
match_querystring=True)
def test_aao_scraper_finds_image(self):
body = """
body = b"""
<br />
<a href="TARGET_URL" title="View larger image"
class="thickbox" style="color: #7E9DA2; text-decoration:none;">
@ -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), [])

View file

@ -15,7 +15,7 @@ deps =
pyechonest
pylast
rarfile
responses
responses>=0.3.0
pathlib
pyxdg
jellyfish