Skip to content

Commit 9d6455e

Browse files
committed
tests: Test signing multiple artifacts
Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent d926803 commit 9d6455e

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

test/assets/integration/b.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DO NOT MODIFY ME!
2+
3+
this is "b.txt", a sample input for sigstore-python's unit tests.
4+
5+
DO NOT MODIFY ME!

test/assets/integration/c.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DO NOT MODIFY ME!
2+
3+
this is "c.txt", a sample input for sigstore-python's unit tests.
4+
5+
DO NOT MODIFY ME!

test/integration/cli/test_sign.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,41 @@ def test_sign_success_default_output_bundle(capsys, sigstore, asset_integration)
8181
)
8282

8383

84+
@pytest.mark.staging
85+
@pytest.mark.ambient_oidc
86+
def test_sign_success_multiple_artifacts(capsys, sigstore, asset_integration):
87+
artifacts = [
88+
asset_integration("a.txt"),
89+
asset_integration("b.txt"),
90+
asset_integration("c.txt"),
91+
]
92+
93+
sigstore(
94+
*get_cli_params(
95+
artifact_paths=artifacts,
96+
)
97+
)
98+
99+
captures = capsys.readouterr()
100+
101+
for artifact in artifacts:
102+
expected_output_bundle = Path(f"{artifact}.sigstore.json")
103+
104+
assert f"Sigstore bundle written to {expected_output_bundle}\n" in captures.out
105+
106+
assert expected_output_bundle.exists()
107+
verifier = Verifier.staging()
108+
with (
109+
open(expected_output_bundle, "r") as bundle_file,
110+
open(artifact, "rb") as input_file,
111+
):
112+
bundle = Bundle.from_json(bundle_file.read())
113+
expected_output_bundle.unlink()
114+
verifier.verify_artifact(
115+
input_=input_file.read(), bundle=bundle, policy=UnsafeNoOp()
116+
)
117+
118+
84119
@pytest.mark.staging
85120
@pytest.mark.ambient_oidc
86121
def test_sign_success_custom_outputs(capsys, sigstore, asset_integration, tmp_path):

0 commit comments

Comments
 (0)