diff --git a/cli/tests/integration.rs b/cli/tests/integration.rs index 04fd18f52..77ba0ad9e 100644 --- a/cli/tests/integration.rs +++ b/cli/tests/integration.rs @@ -36,6 +36,7 @@ fn temp_path(name: &str) -> PathBuf { create_dir_all(&path).ok(); path.join(name) } + #[test] fn tool_not_found() -> Result<(), Box> { let mut cmd = Command::cargo_bin("c2patool")?; @@ -43,6 +44,7 @@ fn tool_not_found() -> Result<(), Box> { cmd.assert().failure().stderr(str::contains("os error")); Ok(()) } + #[test] fn tool_not_found_info() -> Result<(), Box> { let mut cmd = Command::cargo_bin("c2patool")?; @@ -52,6 +54,7 @@ fn tool_not_found_info() -> Result<(), Box> { .stderr(str::contains("file not found")); Ok(()) } + #[test] fn tool_jpeg_no_report() -> Result<(), Box> { let mut cmd = Command::cargo_bin("c2patool")?; @@ -93,6 +96,7 @@ fn tool_embed_jpeg_report() -> Result<(), Box> { .stdout(str::contains("My Title")); Ok(()) } + #[test] fn tool_fs_output_report() -> Result<(), Box> { let path = temp_path("output_dir"); @@ -120,6 +124,7 @@ fn tool_fs_output_report() -> Result<(), Box> { ); Ok(()) } + #[test] fn tool_fs_output_report_supports_detailed_flag() -> Result<(), Box> { let path = temp_path("./output_detailed"); @@ -144,6 +149,7 @@ fn tool_fs_output_report_supports_detailed_flag() -> Result<(), Box> .is_some()); Ok(()) } + #[test] fn tool_fs_output_fails_when_output_exists() -> Result<(), Box> { let path = temp_path("./output_conflict"); @@ -160,6 +166,7 @@ fn tool_fs_output_fails_when_output_exists() -> Result<(), Box> { )); Ok(()) } + #[test] // c2patool tests/fixtures/C.jpg -fo target/tmp/manifest_test fn tool_test_manifest_folder() -> Result<(), Box> { @@ -180,6 +187,7 @@ fn tool_test_manifest_folder() -> Result<(), Box> { assert!(json.contains("make_test_images")); Ok(()) } + #[test] // c2patool tests/fixtures/C.jpg -ifo target/tmp/ingredient_test fn tool_test_ingredient_folder() -> Result<(), Box> { @@ -199,6 +207,7 @@ fn tool_test_ingredient_folder() -> Result<(), Box> { assert!(json.contains("manifest_data")); Ok(()) } + #[test] // c2patool tests/fixtures/C.jpg -ifo target/tmp/ingredient_json // c2patool tests/fixtures/earth_apollo17.jpg -m sample/test.json -p target/tmp/ingredient_json/ingredient.json -fo target/tmp/out_2.jpg @@ -230,6 +239,7 @@ fn tool_test_manifest_ingredient_json() -> Result<(), Box .stdout(str::contains("My Title")); Ok(()) } + #[test] // c2patool tests/fixtures/earth_apollo17.jpg -m tests/fixtures/ingredient_test.json -fo target/tmp/ingredients.jpg fn tool_embed_jpeg_with_ingredients_report() -> Result<(), Box> { @@ -248,6 +258,7 @@ fn tool_embed_jpeg_with_ingredients_report() -> Result<(), Box> { .stdout(str::contains("earth_apollo17.jpg")); Ok(()) } + #[test] fn tool_extensions_do_not_match() -> Result<(), Box> { let path = temp_path("./foo.png"); @@ -262,6 +273,7 @@ fn tool_extensions_do_not_match() -> Result<(), Box> { .stderr(str::contains("Output type must match source type")); Ok(()) } + #[test] fn tool_similar_extensions_match() -> Result<(), Box> { let path = temp_path("./similar.JpEg"); @@ -277,6 +289,7 @@ fn tool_similar_extensions_match() -> Result<(), Box> { .stdout(str::contains("similar.")); Ok(()) } + #[test] fn tool_fail_if_thumbnail_missing() -> Result<(), Box> { Command::cargo_bin("c2patool")? @@ -534,3 +547,20 @@ fn tool_tree() -> Result<(), Box> { .stdout(str::contains("Assertion:c2pa.actions")); Ok(()) } + +#[test] +// c2patool C_with_CAWG_data.jpg +fn tool_read_image_with_cawg_data() -> Result<(), Box> { + Command::cargo_bin("c2patool")? + .arg(fixture_path("C_with_CAWG_data.jpg")) + .assert() + .success() + .stdout(str::contains("cawg.identity")) + .stdout(str::contains("credentialSubject")) + .stdout(str::contains("verifiedIdentities")) + .stdout(str::contains("credentialSchema")) + .stdout(str::contains("cawg.social_media")) + .stdout(str::contains("VerifiableCredential")) + .stdout(str::contains("IdentityClaimsAggregationCredential")); + Ok(()) +}