Beispiel #1
0
    def test_get_image(self):
        directory = os.path.dirname(__file__)
        path = "../resources/spotseeker/file/api/v1/spot/20/image/1"
        mock_path = os.path.join(directory, path)
        with open(mock_path, "rb") as f:
            expected_img = Image.open(BytesIO(bytearray(f.read())))

        spotseeker = Spotseeker()
        response, content = spotseeker.get_spot_image(20, 1)
        byte_img = bytearray(response.data)
        img = Image.open(BytesIO(byte_img))
        self.assertEqual(img, expected_img)
Beispiel #2
0
def get_spot_image(spot_id, image_id, width=None):
    ss = Spotseeker()
    return ss.get_spot_image(spot_id, image_id, width)