def test_packages_create_delete(client, dataset): # init pkg = DataPackage("Some MRI", package_type="MRI") assert not pkg.exists # create dataset.add(pkg) assert pkg.exists assert pkg.id is not None assert pkg.name == "Some MRI" assert pkg.owner_id == client.profile.int_id # TODO: (once we auto-include in parent) assert pkg in dataset # update package name pkg.name = "Some Other MRI" pkg = client.update(pkg) pkg2 = client.get(pkg.id) assert pkg2.name == "Some Other MRI" assert pkg2.id == pkg.id assert pkg2.owner_id == client.profile.int_id # delete all packages client.delete(pkg) assert not pkg.exists pkg = DataPackage("Something else", package_type="TimeSeries") assert not pkg.exists dataset.add(pkg) assert pkg.exists pid = pkg.id pkg.delete() assert not pkg.exists pkg2 = client.get(pid) assert pkg2 is None
def test_packages_create_delete(client, dataset): # init pkg = DataPackage('Some MRI', package_type='MRI') assert not pkg.exists # create dataset.add(pkg) assert pkg.exists assert pkg.id is not None assert pkg.name == 'Some MRI' # TODO: (once we auto-include in parent) assert pkg in dataset # update package name pkg.name = 'Some Other MRI' pkg = client.update(pkg) pkg2 = client.get(pkg.id) assert pkg2.name == 'Some Other MRI' assert pkg2.id == pkg.id # delete all packages client.delete(pkg) assert not pkg.exists pkg = DataPackage('Something else', package_type='TimeSeries') assert not pkg.exists dataset.add(pkg) assert pkg.exists pid = pkg.id pkg.delete() assert not pkg.exists pkg2 = client.get(pid) assert pkg2 is None