def test_upload(client, dataset): """ Note: ETL will fail since destination will likely be removed before being processed. """ srcdir = os.path.dirname(__file__) file1 = os.path.join(srcdir, 'test-upload.txt') files = [file1] # upload a file into dataset r = dataset.upload(*files) assert len(r['files']) == len(files) assert 'destination' not in r assert r['dataset'] == dataset.id assert r['appendToPackage'] == False # try uploading into a DataPackage pkg = DataPackage('Rando Thing', package_type='MRI') dataset.add(pkg) assert pkg.exists # should definitely raise an error with pytest.raises(Exception): pkg.upload(*files)
def test_upload(client, dataset): """ Note: ETL will fail since destination will likely be removed before being processed. """ srcdir = os.path.dirname(__file__) file1 = os.path.join(srcdir, 'test-upload.txt') files = [file1] # upload a file into dataset r = dataset.upload(*files) assert len(r) == len(files) manifest = r[0][0]['manifest'] assert manifest['content'] is not None assert manifest['type'] == 'upload' # try uploading into a DataPackage pkg = DataPackage('Rando Thing', package_type='MRI') dataset.add(pkg) assert pkg.exists # should definitely raise an error with pytest.raises(Exception): pkg.upload(*files)