def test_successful_publish(col_id, col_version, publication_message, legacy_username, legacy_password): # GIVEN the latest version of a collection available with Neb.get(verbose=True, env="staging", col_id=col_id, col_version="latest") as coll_dir: # WHEN we make an edit with edit_collXML(coll_dir) as collection: elem = collection.xpath("//md:title", namespaces=COLLECTION_NSMAP)[0] elem.text = "a different collection title {}".format( random.randint(0, 99999)) # THEN we are able to successfully publish it stdout, stderr, returncode = Neb.run( "publish", "staging", coll_dir, "--message", publication_message, "--username", legacy_username, "--password", legacy_password, ) assert "Great work!!! =D" in stderr
def test_get_help(): # GIVEN neb # WHEN we run `neb get --help` with Neb.get(help=True) as help: # THEN the usage message is displayed assert "Usage: neb get " in help assert "Options:" in help assert "--help" in help
def test_get_col_minor_version(insecure, neb_env, col_id, col_version, snapshot): # GIVEN neb, an environment name, a collection id, a collection version, and the snapshot tool snapshot_name = get_neb_snapshot_name(col_id, col_version) # WHEN we run `neb get --verbose env col_id col_version` with Neb.get( verbose=True, insecure=insecure, env=neb_env, col_id=col_id, col_version=col_version, input="y", ) as zip_dir: # THEN the complete zip is downloaded and matches the snapshot snapshot.assert_file_or_dir_match(zip_dir, snapshot_name)
def test_get_col_latest(insecure, neb_env, col_id, col_minimum_version): # GIVEN neb, an environment name, a collection id, and a collection minimum version # WHEN we run `neb get --verbose env col_id latest` with Neb.get( verbose=True, insecure=insecure, env=neb_env, col_id=col_id, col_version="latest" ) as zip_dir: # THEN the complete zip is downloaded and has a collection.xml # with the minimum version or higher path = join(zip_dir, "collection.xml") with open(path) as file: colxml = file.read() collection = ET.fromstring(colxml) metadata = collection.find("{http://cnx.rice.edu/collxml}metadata") version_string = metadata.find("{http://cnx.rice.edu/mdml}version").text version = parse_version(version_string) minimum_version = parse_version(col_minimum_version) assert version >= minimum_version