def test_resource_publish() -> None: """Test datapackage resource publish.""" dp = deetly.metadata(metadata) dp.df(df, "Iris", "Iris dataset") dp.publish() assert len(dp.resources) == 1
def test_add_link() -> None: """Test datapackage add link.""" dp = deetly.metadata(metadata) dp.link("https://storage.googleapis.com/deetly/data/test.pdf", "Test pdf") assert (len(dp.resources) == 1 and dp.resources[0]["format"] == "pdf" and dp.resources[0]["mediatype"] == "application/pdf")
def test_toJSON() -> None: """Test datapackage toJSON.""" dp = deetly.metadata(metadata) res = dp.toJSON() assert res.get("name") == metadata.get("name")
def test_metadata_publish() -> None: """Test datapackage publish.""" dp = deetly.metadata(metadata) dp.publish() id = deetly.utils.get_id_from_metadata(metadata) assert dp.id == id
def test_metadata_init() -> None: """Test metadata init.""" dp = deetly.metadata(metadata) assert dp.title == metadata.get("name")