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_package_states(client, dataset): pkg = DataPackage('My Stateful Package', package_type='Slide') assert not pkg.exists dataset.add(pkg) assert pkg.exists assert pkg.state == "UNAVAILABLE" pkg.set_ready() pkg2 = client.get(pkg.id) assert pkg2.id == pkg.id assert pkg2.state == pkg.state assert pkg2.state == "READY" pkg.set_error() del pkg2 pkg2 = client.get(pkg.id) assert pkg2.id == pkg.id assert pkg2.state == pkg.state assert pkg2.state == "ERROR" del pkg2 pkg.delete()
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