-
Notifications
You must be signed in to change notification settings - Fork 3
feat(actions-assertion): #55: add implementation of action assertion #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aasheptunov
merged 11 commits into
develop
from
feature/#55-add-implementation-of-action-assertion
May 6, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2f09756
feat(actions-assertion): #55: add implementation of actions assertion
aasheptunov e60ef30
test(actions-assertion): #55: add tests for Actions Assertion
aasheptunov 6ee116f
fix: #55: convert line endings from CRLF to LF
aasheptunov c58f012
docs(actions-assertion): #55: correct of the comment to reflect the f…
aasheptunov 078c532
docs(readme): bring test coverage score up to date
github-actions[bot] 94444a3
refactor(actions-assertion): #55: move Actions assertion tests to sep…
aasheptunov 61f5a86
refactor(actions-assertion): #55: formatting correction
aasheptunov 3c311ec
fix(actions-assertion): #55: fix a formatting-related error
aasheptunov c5359b4
refactor(actions-assertion): #55: simplification of the condition
aasheptunov f029ddb
feat(actions-assertion): #55: add a validation step for valid values …
aasheptunov a509f9d
docs(readme): bring test coverage score up to date
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,56 @@ | ||
| from c2pie.c2pa.assertion import ActionsAssertion | ||
| from c2pie.utils.assertion_schemas import cbor_to_bytes | ||
| from c2pie.utils.content_types import jumbf_content_types | ||
|
|
||
|
|
||
| def test_actions_assertion_content_type_is_cbor(): | ||
| actions_assertion = ActionsAssertion(action="c2pa.created") | ||
| assert actions_assertion.get_content_type() == jumbf_content_types["cbor"] | ||
|
|
||
|
|
||
| def test_actions_assertion_label(): | ||
| actions_assertion = ActionsAssertion(action="c2pa.created") | ||
| assert actions_assertion.get_label() == "c2pa.actions.v2" | ||
|
|
||
|
|
||
| def test_actions_assertion_schema_fields(): | ||
| actions_assertion = ActionsAssertion(action="c2pa.created") | ||
| assert actions_assertion.schema["actions"][0]["action"] == "c2pa.created" | ||
|
|
||
|
|
||
| def test_actions_assertion_schema_has_no_parameters_by_default(): | ||
| actions_assertion = ActionsAssertion(action="c2pa.created") | ||
| assert "parameters" not in actions_assertion.schema["actions"][0] | ||
|
|
||
|
|
||
| def test_actions_assertion_schema_fields_with_parameters(): | ||
| expected_parameters = { | ||
| "ingredients": [ | ||
| { | ||
| "url": "self#jumbf=c2pa.assertions/c2pa.ingredient.v3", | ||
| "alg": "sha256", | ||
| "hash": "B-X0kqzQsdIOC9ZxU7M/FRaaLlQ8Ap1U95//TucEjkT=", | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| actions_assertion = ActionsAssertion(action="c2pa.opened", parameters=expected_parameters) | ||
| assert actions_assertion.schema["actions"][0]["action"] == "c2pa.opened" | ||
| assert actions_assertion.schema["actions"][0]["parameters"] == expected_parameters | ||
|
|
||
|
|
||
| def test_actions_assertion_serializes_as_cbor(): | ||
| actions_assertion = ActionsAssertion(action="c2pa.created") | ||
|
|
||
| expected_payload = cbor_to_bytes( | ||
| { | ||
| "actions": [ | ||
| { | ||
| "action": "c2pa.created", | ||
| }, | ||
| ], | ||
| }, | ||
| ) | ||
|
|
||
| assert len(actions_assertion.content_boxes) == 1 | ||
| assert actions_assertion.content_boxes[0].payload == expected_payload |
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.