def test_download(api_client, uploaded_file_ids, filename): # See comment in uploaded_file_ids() original_filename = filename if filename == 'piece-jointe.jpg': filename = u'pièce-jointe.jpg' elif filename == 'andra-moi-ennepe.txt': filename = u'ἄνδρα μοι ἔννεπε' in_file = api_client.get_data(u'/files?filename={}'.format(filename))[0] data = api_client.get_raw('/files/{}/download'.format(in_file['id'])).data path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', original_filename.encode('utf-8')) local_data = open(path, 'rb').read() local_md5 = md5.new(local_data).digest() dl_md5 = md5.new(data).digest() assert local_md5 == dl_md5
def test_handle_not_found_calendar(api_client): resp_data = api_client.get_raw('/calendars/foo') assert resp_data.status_code == 404