-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cawg_identity): Refactor boilerplate code for manifest and pare…
…nt JSON in test cases (#949) Refactor boilerplate code for manifest and parent JSON in test cases
- Loading branch information
1 parent
da13c79
commit 85f97b5
Showing
4 changed files
with
73 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2025 Adobe. All rights reserved. | ||
// This file is licensed to you under the Apache License, | ||
// Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
// or the MIT license (http://opensource.org/licenses/MIT), | ||
// at your option. | ||
|
||
// Unless required by applicable law or agreed to in writing, | ||
// this software is distributed on an "AS IS" BASIS, WITHOUT | ||
// WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or | ||
// implied. See the LICENSE-MIT and LICENSE-APACHE files for the | ||
// specific language governing permissions and limitations under | ||
// each license. | ||
|
||
use serde_json::json; | ||
|
||
/// Boilerplate JSON to use when building manifests for test cases. | ||
pub(crate) fn manifest_json() -> String { | ||
json!({ | ||
"vendor": "test", | ||
"claim_generator_info": [ | ||
{ | ||
"name": "c2pa_test", | ||
"version": "1.0.0" | ||
} | ||
], | ||
"metadata": [ | ||
{ | ||
"dateTime": "1985-04-12T23:20:50.52Z", | ||
"my_custom_metadata": "my custom metatdata value" | ||
} | ||
], | ||
"title": "Test_Manifest", | ||
"format": "image/tiff", | ||
"instance_id": "1234", | ||
"thumbnail": { | ||
"format": "image/jpeg", | ||
"identifier": "thumbnail.jpg" | ||
}, | ||
"ingredients": [ | ||
{ | ||
"title": "Test", | ||
"format": "image/jpeg", | ||
"instance_id": "12345", | ||
"relationship": "componentOf" | ||
} | ||
], | ||
"assertions": [ | ||
{ | ||
"label": "org.test.assertion", | ||
"data": "assertion" | ||
} | ||
] | ||
}) | ||
.to_string() | ||
} | ||
|
||
pub(crate) fn parent_json() -> String { | ||
json!({ | ||
"title": "Parent Test", | ||
"format": "image/jpeg", | ||
"instance_id": "12345", | ||
"relationship": "parentOf" | ||
}) | ||
.to_string() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters