Exemplo n.º 1
0
 def test_large_playlist_cover_image(self):
     # From https://dog.ceo/api/breeds/image/random
     large_image = "https://images.dog.ceo/breeds/pointer-germanlonghair/hans2.jpg"
     dog_base64 = helpers.get_as_base64(large_image)
     try:
         self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64)
     except Exception as e:
         self.assertIsInstance(e, SpotifyException)
         self.assertEqual(e.http_status, 413)
         return
     self.fail()
Exemplo n.º 2
0
    def test_playlist_cover_image(self):
        # Upload random dog image
        r = requests.get('https://dog.ceo/api/breeds/image/random')
        dog_base64 = helpers.get_as_base64(r.json()['message'])
        self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64)

        res = self.spotify.playlist_cover_image(self.new_playlist_uri)
        self.assertEqual(len(res), 1)
        first_image = res[0]
        self.assertIn('width', first_image)
        self.assertIn('height', first_image)
        self.assertIn('url', first_image)
Exemplo n.º 3
0
    def test_playlist_cover_image(self):
        # From https://dog.ceo/api/breeds/image/random
        small_image = "https://images.dog.ceo/breeds/poodle-toy/n02113624_8936.jpg"
        dog_base64 = helpers.get_as_base64(small_image)
        self.spotify.playlist_upload_cover_image(self.new_playlist_uri, dog_base64)

        res = self.spotify.playlist_cover_image(self.new_playlist_uri)
        self.assertEqual(len(res), 1)
        first_image = res[0]
        self.assertIn('width', first_image)
        self.assertIn('height', first_image)
        self.assertIn('url', first_image)