Debian Codegraph @

tests/test_in_toto_run.py

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 #!/usr/bin/env python
2
3 # Copyright New York University and the in-toto contributors
4 # SPDX-License-Identifier: Apache-2.0
5
6 """
7 <Program Name>
8 test_in_toto_run.py
9
10 <Author>
11 Lukas Puehringer <[email protected]>
12
13 <Started>
14 Nov 28, 2016
15
16 <Copyright>
17 See LICENSE for licensing information.
18
19 <Purpose>
20 Test in_toto_run command line tool.
21
22 """
23
24 import globscip-python python python-stdlib 3.11 glob/__init__:
25 import osscip-python python python-stdlib 3.11 os/__init__:
26 import tempfilescip-python python python-stdlib 3.11 tempfile/__init__:
27 import unittestscip-python python python-stdlib 3.11 unittest/__init__:
28 from pathlibscip-python python python-stdlib 3.11 pathlib/__init__: import Pathscip-python python python-stdlib 3.11 pathlib/Path#
29 from unittestscip-python python python-stdlib 3.11 unittest/__init__: import mockscip-python python python-stdlib 3.11 `unittest.mock`/__init__:
30
31 import securesystemslib.interfacescip-python python securesystemslib 1.4.0 `securesystemslib.interface`/__init__: # pylint: disable=unused-import
32
33 from in_toto.in_toto_runscip-python python in-toto 2.0.0 `in_toto.in_toto_run`/__init__: import main as in_toto_run_mainscip-python python in-toto 2.0.0 `in_toto.in_toto_run`/main().
34 from in_toto.models.linkscip-python python in-toto 2.0.0 `in_toto.models.link`/__init__: import FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT.
35 from in_toto.models.metadatascip-python python in-toto 2.0.0 `in_toto.models.metadata`/__init__: import Metablockscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#, Metadatascip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#
36 from tests.commonscip-python python in-toto 2.0.0 `tests.common`/__init__: import CliTestCasescip-python python in-toto 2.0.0 `tests.common`/CliTestCase#, GenKeysMixinscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#, GPGKeysMixinscip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#, TmpDirMixinscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#
37
38
39 class TestInTotoRunToolscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#(CliTestCasescip-python python in-toto 2.0.0 `tests.common`/CliTestCase#, TmpDirMixinscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#, GPGKeysMixinscip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#, GenKeysMixinscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#):
40 """Test in_toto_run's main() - requires sys.argv patching; and
41 in_toto_run- calls runlib and error logs/exits on Exception."""
42
43 cli_main_funcscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#cli_main_func. = staticmethodscip-python python python-stdlib 3.11 builtins/staticmethod#(in_toto_run_mainscip-python python in-toto 2.0.0 `in_toto.in_toto_run`/main().)
44
45 @classmethodscip-python python python-stdlib 3.11 builtins/classmethod#
46 def setUpClassscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self)):
47 """Create and change into temporary directory,
48 generate key pair, dummy artifact and base arguments."""
49 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).set_up_test_dirscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#set_up_test_dir().()
50 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).set_up_gpg_keysscip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#set_up_gpg_keys().()
51 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).set_up_keysscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#set_up_keys().()
52
53 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step. = "test_step"
54 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
55 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).rsa_key_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_id.
56 )
57 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_link_ed25519scip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ed25519. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
58 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).ed25519_key_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ed25519_key_id.
59 )
60 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_link_ecdsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ecdsa. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
61 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).ecdsa_key_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ecdsa_key_id.
62 )
63 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_link_rsa_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa_enc. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
64 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).rsa_key_enc_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_enc_id.
65 )
66 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_link_ed25519_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ed25519_enc. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
67 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).ed25519_key_enc_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ed25519_key_enc_id.
68 )
69 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_link_ecdsa_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ecdsa_enc. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
70 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).ecdsa_key_enc_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ecdsa_key_enc_id.
71 )
72
73 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact. = "test_artifact"
74 Pathscip-python python python-stdlib 3.11 pathlib/Path#(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#setUpClass().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.).touchscip-python python python-stdlib 3.11 pathlib/Path#touch().()
75
76 @classmethodscip-python python python-stdlib 3.11 builtins/classmethod#
77 def tearDownClassscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#tearDownClass().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#tearDownClass().(self)):
78 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#tearDownClass().(self).tear_down_test_dirscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#tear_down_test_dir().()
79
80 def tearDownscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#tearDown().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#tearDown().(self)):
81 for link in globscip-python python python-stdlib 3.11 glob/__init__:.globscip-python python python-stdlib 3.11 glob/glob().("*.link"):
82 osscip-python python python-stdlib 3.11 os/__init__:.removescip-python python python-stdlib 3.11 os/remove().(link)
83
84 def test_main_required_argsscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_required_args().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_required_args().(self)):
85 """Test CLI command with required arguments."""
86
87 args = [
88 "--step-name",
89 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_required_args().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
90 "--key",
91 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_required_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
92 "--",
•93 "python3",
94 "--version",
95 ]
96
97 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_required_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
98 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_required_args().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_required_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.))
99
100 def test_main_optional_argsscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self)):
101 """Test CLI command with optional arguments."""
102
103 named_args = [
104 "--step-name",
105 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
106 "--key",
107 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
108 "--materials",
109 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.,
110 "--products",
111 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.,
112 "--record-streams",
113 ]
•114 positional_args = ["--", "python3", "--version"]
115
116 # Test and assert recorded artifacts
117 args1 = named_args + positional_args
118 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args1, 0)
119 link_metadata = Metablockscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.)
120 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertTrue(
121 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact. in listscip-python python python-stdlib 3.11 builtins/list#(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..materials.keys())
122 )
123 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertTrue(
124 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact. in listscip-python python python-stdlib 3.11 builtins/list#(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..products.keys())
125 )
126
127 # Test and assert exlcuded artifacts
128 args2 = named_args + ["--exclude", "*test*"] + positional_args
129 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args2, 0)
130 link_metadata = Metablockscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.)
131 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertFalse(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..materials)
132 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertFalse(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..products)
133
134 # Test with base path
135 args3 = named_args + ["--base-path", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_dirscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#test_dir.] + positional_args
136 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args3, 0)
137 link_metadata = Metablockscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.)
138 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertListEqual(
139 listscip-python python python-stdlib 3.11 builtins/list#(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..materials.keys()), [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.]
140 )
141 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertListEqual(
142 listscip-python python python-stdlib 3.11 builtins/list#(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..products.keys()), [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.]
143 )
144
145 # Test with bogus base path
146 args4 = named_args + ["--base-path", "bogus/path"] + positional_args
147 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args4, 1)
148
149 # Test with lstrip path
150 strip_prefix = selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.[:-1]
151 args5 = named_args + ["--lstrip-paths", strip_prefix] + positional_args
152 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args5, 0)
153 link_metadata = Metablockscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.)
154 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertListEqual(
155 listscip-python python python-stdlib 3.11 builtins/list#(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..materials.keys()),
156 [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.[len(strip_prefix) :]],
157 )
158 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).assertListEqual(
159 listscip-python python python-stdlib 3.11 builtins/list#(link_metadata.signedscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#signed..products.keys()),
160 [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_artifact.[len(strip_prefix) :]],
161 )
162
163 def test_main_with_metadata_directoryscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_metadata_directory().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_metadata_directory().(self)):
164 """Test CLI command with metadata directory."""
165 tmp_dir = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..realpathscip-python python python-stdlib 3.11 ntpath/join().(tempfilescip-python python python-stdlib 3.11 tempfile/__init__:.mkdtempscip-python python python-stdlib 3.11 tempfile/mkdtemp().(dir=osscip-python python python-stdlib 3.11 os/__init__:.getcwdscip-python python python-stdlib 3.11 os/getcwd().()))
166 args = [
167 "--step-name",
168 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_metadata_directory().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
169 "--key",
170 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_metadata_directory().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
171 "--metadata-directory",
172 tmp_dir,
173 "--",
•174 "python3",
175 "--version",
176 ]
177
178 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_metadata_directory().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
179
180 linkpath = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..joinscip-python python python-stdlib 3.11 ntpath/join().(tmp_dir, selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_metadata_directory().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.)
181
182 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_metadata_directory().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(linkpath))
183
184 def test_main_with_unencrypted_ed25519_keyscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ed25519_key().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ed25519_key().(self)):
185 """Test CLI command with ed25519 key."""
186 args = [
187 "-n",
188 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ed25519_key().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
189 "--key",
190 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ed25519_key().(self).ed25519_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ed25519_key_path.,
191 "--key-type",
192 "ed25519",
193 "--",
194 "ls",
195 ]
196
197 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ed25519_key().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
198 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ed25519_key().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ed25519_key().(self).test_link_ed25519scip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ed25519.))
199
200 def test_main_with_unencrypted_ecdsa_keyscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ecdsa_key().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ecdsa_key().(self)):
201 """Test CLI command with ecdsa key."""
202 args = [
203 "-n",
204 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ecdsa_key().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
205 "--key",
206 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ecdsa_key().(self).ecdsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ecdsa_key_path.,
207 "--key-type",
208 "ecdsa",
209 "--",
210 "ls",
211 ]
212
213 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ecdsa_key().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
214 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ecdsa_key().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_unencrypted_ecdsa_key().(self).test_link_ecdsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ecdsa.))
215
216 def test_main_with_encrypted_keysscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self)):
217 """Test CLI command with encrypted ed25519 key."""
218
219 for key_type, key_path, link_path in [
220 ("rsa", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).rsa_key_enc_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_enc_path., selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).test_link_rsa_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa_enc.),
221 ("ed25519", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).ed25519_key_enc_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ed25519_key_enc_path., selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).test_link_ed25519_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ed25519_enc.),
222 ("ecdsa", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).ecdsa_key_enc_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ecdsa_key_enc_path., selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).test_link_ecdsa_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ecdsa_enc.),
223 ]:
224 # Define common arguments passed to in in-toto-run below
225 args = [
226 "-n",
227 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
228 "--key",
229 key_path,
230 "--key-type",
231 key_type,
232 ]
•233 cmd = ["--", "python3", "--version"]
234
235 # Make sure the link file to be generated doesn't already exist
236 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).assertFalse(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(link_path))
237
238 # Test 1: Call in-toto-run entering signing key password on prompt
239 with mockscip-python python python-stdlib 3.11 `unittest.mock`/__init__:.patch(
240 "securesystemslib.interface.get_password",
241 return_value=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).key_pwscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#key_pw.,
242 ):
243 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args + ["--password"] + cmd, 0)
244
245 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(link_path))
246 osscip-python python python-stdlib 3.11 os/__init__:.removescip-python python python-stdlib 3.11 os/remove().(link_path)
247
248 # Test 2: Call in-toto-run passing signing key password
249 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(
250 args + ["--password", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).key_pwscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#key_pw.] + cmd, 0
251 )
252 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_encrypted_keys().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(link_path))
253 osscip-python python python-stdlib 3.11 os/__init__:.removescip-python python python-stdlib 3.11 os/remove().(link_path)
254
255 def test_main_with_specified_gpg_keyscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self)):
256 """Test CLI command with specified gpg key."""
257 args = [
258 "-n",
259 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
260 "--gpg",
261 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self).gpg_key_85DA58scip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#gpg_key_85DA58.,
262 "--gpg-home",
263 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self).gnupg_homescip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#gnupg_home.,
264 "--",
•265 "python3",
266 "--version",
267 ]
268
269 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
270 link_filename = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
271 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self).gpg_key_85DA58scip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#gpg_key_85DA58.
272 )
273
274 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_specified_gpg_key().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(link_filename))
275
276 def test_main_with_default_gpg_keyscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(self)):
277 """Test CLI command with default gpg key."""
278 args = [
279 "-n",
280 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
281 "--gpg",
282 "--gpg-home",
283 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(self).gnupg_homescip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#gnupg_home.,
284 "--",
•285 "python3",
286 "--version",
287 ]
288
289 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
290
291 link_filename = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
292 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(self).gpg_key_D924E9scip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#gpg_key_D924E9.
293 )
294
295 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_with_default_gpg_key().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(link_filename))
296
297 def test_main_no_command_argscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_no_command_arg().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_no_command_arg().(self)):
298 """Test CLI command with --no-command argument."""
299
300 args = [
301 "in_toto_run.py",
302 "--step-name",
303 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_no_command_arg().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
304 "--key",
305 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_no_command_arg().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
306 "--no-command",
307 ]
308
309 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_no_command_arg().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
310
311 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_no_command_arg().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_no_command_arg().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.))
312
313 def test_main_wrong_argsscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self)):
314 """Test CLI command with missing arguments."""
315
316 wrong_args_list = [
317 [],
318 ["--step-name", "some"],
319 ["--key", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.],
320 ["--", "echo", "blub"],
321 ["--step-name", "test-step", "--key", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.],
322 ["--step-name", "--", "echo", "blub"],
323 ["--key", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path., "--", "echo", "blub"],
324 ["--step-name", "test-step", "--key", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path., "--"],
325 [
326 "--step-name",
327 "test-step",
328 "--key",
329 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
330 "--gpg",
331 "--",
332 "echo",
333 "blub",
334 ],
335 ]
336
337 for wrong_args in wrong_args_list:
338 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(wrong_args, 2)
339 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).assertFalse(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.))
340
341 def test_main_wrong_key_exitsscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_key_exits().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_key_exits().(self)):
342 """Test CLI command with wrong key argument, exits and logs error"""
343
344 args = [
345 "--step-name",
346 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_key_exits().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step.,
347 "--key",
348 "non-existing-key",
349 "--",
350 "echo",
351 "test",
352 ]
353
354 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_key_exits().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 1)
355 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_key_exits().(self).assertFalse(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_wrong_key_exits().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa.))
356
357 def test_main_encrypted_key_but_no_pwscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self)):
358 """Test CLI command exits 1 with encrypted key but no pw."""
359 args = ["-n", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., "--key", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).rsa_key_enc_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_enc_path., "-x"]
360 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 1)
361 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).assertFalse(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).test_link_rsa_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_rsa_enc.))
362
363 args = ["-n", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_step., "--key", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).ed25519_key_enc_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ed25519_key_enc_path., "-x"]
364 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 1)
365 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).assertFalse(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_main_encrypted_key_but_no_pw().(self).test_link_ed25519_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunTool#test_link_ed25519_enc.))
366
367
368 class TestInTotoRunToolWithDSSEscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#(
369 CliTestCasescip-python python in-toto 2.0.0 `tests.common`/CliTestCase#, TmpDirMixinscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#, GPGKeysMixinscip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#, GenKeysMixinscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#
370 ):
371 """Test in_toto_run's main() with --use-dsse argument - requires sys.argv
372 patching; and in_toto_run- calls runlib and error logs/exits on Exception.
373 """
374
375 cli_main_funcscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#cli_main_func. = staticmethodscip-python python python-stdlib 3.11 builtins/staticmethod#(in_toto_run_mainscip-python python in-toto 2.0.0 `in_toto.in_toto_run`/main().)
376
377 @classmethodscip-python python python-stdlib 3.11 builtins/classmethod#
378 def setUpClassscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self)):
379 """Create and change into temporary directory,
380 generate key pair, dummy artifact and base arguments."""
381 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).set_up_test_dirscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#set_up_test_dir().()
382 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).set_up_gpg_keysscip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#set_up_gpg_keys().()
383 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).set_up_keysscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#set_up_keys().()
384
385 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step. = "test_step"
386 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
387 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).rsa_key_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_id.
388 )
389 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_link_ed25519scip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_ed25519. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
390 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).ed25519_key_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ed25519_key_id.
391 )
392 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_link_rsa_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa_enc. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
393 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).rsa_key_enc_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_enc_id.
394 )
395 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_link_ed25519_encscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_ed25519_enc. = FILENAME_FORMATscip-python python in-toto 2.0.0 `in_toto.models.link`/FILENAME_FORMAT..format(
396 step_name=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step., keyid=selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).ed25519_key_enc_idscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#ed25519_key_enc_id.
397 )
398
399 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact. = "test_artifact"
400 Pathscip-python python python-stdlib 3.11 pathlib/Path#(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#setUpClass().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.).touchscip-python python python-stdlib 3.11 pathlib/Path#touch().()
401
402 @classmethodscip-python python python-stdlib 3.11 builtins/classmethod#
403 def tearDownClassscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#tearDownClass().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#tearDownClass().(self)):
404 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#tearDownClass().(self).tear_down_test_dirscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#tear_down_test_dir().()
405
406 def tearDownscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#tearDown().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#tearDown().(self)):
407 for link in globscip-python python python-stdlib 3.11 glob/__init__:.globscip-python python python-stdlib 3.11 glob/glob().("*.link"):
408 osscip-python python python-stdlib 3.11 os/__init__:.removescip-python python python-stdlib 3.11 os/remove().(link)
409
410 def test_main_required_argsscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_required_args().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_required_args().(self)):
411 """Test CLI command with required arguments."""
412
413 args = [
414 "--step-name",
415 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_required_args().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step.,
416 "--key",
417 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_required_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
418 "--use-dsse",
419 "--",
•420 "python3",
421 "--version",
422 ]
423
424 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_required_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
425 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_required_args().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_required_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa.))
426
427 def test_main_optional_argsscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self)):
428 """Test CLI command with optional arguments."""
429
430 named_args = [
431 "--step-name",
432 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step.,
433 "--key",
434 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
435 "--materials",
436 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.,
437 "--products",
438 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.,
439 "--record-streams",
440 "--use-dsse",
441 ]
•442 positional_args = ["--", "python3", "--version"]
443
444 # Test and assert recorded artifacts
445 args1 = named_args + positional_args
446 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args1, 0)
447 metadata = Metadatascip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa.)
448 link = metadata.get_payloadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#get_payload().()
449 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertTrue(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact. in listscip-python python python-stdlib 3.11 builtins/list#(link.materials.keys()))
450 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertTrue(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact. in listscip-python python python-stdlib 3.11 builtins/list#(link.products.keys()))
451
452 # Test and assert exlcuded artifacts
453 args2 = named_args + ["--exclude", "*test*"] + positional_args
454 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args2, 0)
455 link = Metadatascip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa.).get_payloadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#get_payload().()
456 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertFalse(link.materials)
457 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertFalse(link.products)
458
459 # Test with base path
460 args3 = named_args + ["--base-path", selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_dirscip-python python in-toto 2.0.0 `tests.common`/TmpDirMixin#test_dir.] + positional_args
461 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args3, 0)
462 link = Metadatascip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa.).get_payloadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#get_payload().()
463 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertListEqual(listscip-python python python-stdlib 3.11 builtins/list#(link.materials.keys()), [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.])
464 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertListEqual(listscip-python python python-stdlib 3.11 builtins/list#(link.products.keys()), [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.])
465
466 # Test with bogus base path
467 args4 = named_args + ["--base-path", "bogus/path"] + positional_args
468 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args4, 1)
469
470 # Test with lstrip path
471 strip_prefix = selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.[:-1]
472 args5 = named_args + ["--lstrip-paths", strip_prefix] + positional_args
473 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args5, 0)
474 link = Metadatascip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#.loadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metadata#load().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa.).get_payloadscip-python python in-toto 2.0.0 `in_toto.models.metadata`/Metablock#get_payload().()
475 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertListEqual(
476 listscip-python python python-stdlib 3.11 builtins/list#(link.materials.keys()),
477 [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.[len(strip_prefix) :]],
478 )
479 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).assertListEqual(
480 listscip-python python python-stdlib 3.11 builtins/list#(link.products.keys()),
481 [selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_optional_args().(self).test_artifactscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_artifact.[len(strip_prefix) :]],
482 )
483
484 def test_main_with_default_gpg_keyscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_with_default_gpg_key().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_with_default_gpg_key().(self)):
485 """Test CLI command with default gpg key."""
486 args = [
487 "-n",
488 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_with_default_gpg_key().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step.,
489 "--gpg",
490 "--gpg-home",
491 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_with_default_gpg_key().(self).gnupg_homescip-python python in-toto 2.0.0 `tests.common`/GPGKeysMixin#gnupg_home.,
492 "--use-dsse",
493 "--",
•494 "python3",
495 "--version",
496 ]
497
498 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_with_default_gpg_key().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 1)
499
500 def test_main_no_command_argscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_no_command_arg().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_no_command_arg().(self)):
501 """Test CLI command with --no-command argument."""
502
503 args = [
504 "in_toto_run.py",
505 "--step-name",
506 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_no_command_arg().(self).test_stepscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_step.,
507 "--key",
508 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_no_command_arg().(self).rsa_key_pathscip-python python in-toto 2.0.0 `tests.common`/GenKeysMixin#rsa_key_path.,
509 "--no-command",
510 "--use-dsse",
511 ]
512
513 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_no_command_arg().(self).assert_cli_sys_exitscip-python python in-toto 2.0.0 `tests.common`/CliTestCase#assert_cli_sys_exit().(args, 0)
514
515 selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_no_command_arg().(self).assertTrue(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_main_no_command_arg().(self).test_link_rsascip-python python in-toto 2.0.0 `tests.test_in_toto_run`/TestInTotoRunToolWithDSSE#test_link_rsa.))
516
517
518 if __name__scip-python python in-toto 2.0.0 `tests.test_in_toto_run`/ == "__main__":
519 unittestscip-python python python-stdlib 3.11 unittest/__init__:.mainscip-python python in-toto 2.0.0 main/__init__:()