

def test_download(self):
    encoded_source = 'R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
    with open('im.jpg', 'wb') as im_file:
        im_file.write(base64.b64decode(encoded_source))
    image = DownloadableBase64Image(os.path.abspath('im.jpg'))
    serializer = DownloadableBase64ImageSerializer(image)
    try:
        self.assertEqual(serializer.data['image'], encoded_source)
    finally:
        os.remove('im.jpg')

dataset/ETHPy150Open Hipo/drf-extra-fields/tests/test_fields.py Base64ImageSerializerTests.test_download/original