Skip to content

Commit a774091

Browse files
committed
Remove the KEY constant
Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
1 parent 855ddbc commit a774091

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/test_metadata_serialization.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ def wrapper(test_cls: "TestSerialization"):
5050

5151
class TestSerialization(unittest.TestCase):
5252

53-
KEY = '{"keytype": "rsa", "scheme": "rsassa-pss-sha256", \
54-
"keyval": {"public": "foo"}}'
5553
SIGNED_COMMON = '"spec_version": "1.0.0", "version": 1, \
5654
"expires": "2030-01-01T00:00:00Z"'
5755

@@ -79,12 +77,12 @@ def test_role_serialization(self, test_case_data: str):
7977

8078

8179
valid_roots: DataSet = {
82-
"all": f'{{ "_type": "root", {SIGNED_COMMON}, \
83-
"consistent_snapshot": false, "keys": {{"keyid" : {KEY} }}, \
80+
"all": f'{{ "_type": "root", {SIGNED_COMMON}, "consistent_snapshot": false, \
81+
"keys": {{"keyid" : {{"keytype": "rsa", "scheme": "rsassa-pss-sha256", "keyval": {{"public": "foo"}} }} }}, \
8482
"roles": {{ "targets": {{"keyids": ["keyid"], "threshold": 3}} }} \
8583
}}',
8684
"no consistent_snapshot": f'{{ "_type": "root", {SIGNED_COMMON}, \
87-
"keys": {{"keyid" : {KEY}}}, \
85+
"keys": {{"keyid" : {{"keytype": "rsa", "scheme": "rsassa-pss-sha256", "keyval": {{"public": "foo"}} }}}}, \
8886
"roles": {{ "targets": {{"keyids": ["keyid"], "threshold": 3}} }} \
8987
}}',
9088
}
@@ -153,8 +151,8 @@ def test_delegated_role_serialization(self, test_case_data: str):
153151

154152

155153
valid_delegations: DataSet = {
156-
"all": f'{{"keys": {{"keyid" : {KEY}}}, "roles": [ {{"keyids": ["keyid"], \
157-
"name": "a", "terminating": true, "threshold": 3}} ]}}'
154+
"all": '{"keys": {"keyid" : {"keytype": "rsa", "scheme": "rsassa-pss-sha256", "keyval": {"public": "foo"}}}, \
155+
"roles": [ {"keyids": ["keyid"], "name": "a", "terminating": true, "threshold": 3} ]}'
158156
}
159157

160158
@run_sub_tests_with_dataset(valid_delegations)
@@ -180,14 +178,16 @@ def test_targetfile_serialization(self, test_case_data: str):
180178
valid_targets: DataSet = {
181179
"all attributes": f'{{"_type": "targets", {SIGNED_COMMON}, \
182180
"targets": {{ "file.txt": {{"length": 12, "hashes": {{"sha256" : "abc"}} }} }}, \
183-
"delegations": {{"keys": {{"keyid" : {KEY}}}, \
181+
"delegations": {{"keys": {{"keyid" : {{"keytype": "rsa", \
182+
"scheme": "rsassa-pss-sha256", "keyval": {{"public": "foo"}} }}}}, \
184183
"roles": [ {{"keyids": ["keyid"], "name": "a", "terminating": true, "threshold": 3}} ]}} \
185184
}}',
186185
"empty targets": f'{{"_type": "targets", {SIGNED_COMMON}, \
187186
"targets": {{}}, \
188-
"delegations": {{"keys": {{"keyid" : {KEY}}}, \
189-
"roles": [ {{"keyids": ["keyid"], "name": "a", "terminating": true, "threshold": 3}} ] \
190-
}} }}',
187+
"delegations": {{"keys": {{"keyid" : {{"keytype": "rsa", \
188+
"scheme": "rsassa-pss-sha256", "keyval": {{"public": "foo"}} }}}}, \
189+
"roles": [ {{"keyids": ["keyid"], "name": "a", "terminating": true, "threshold": 3}} ]}} \
190+
}}',
191191
"no delegations": f'{{"_type": "targets", {SIGNED_COMMON}, \
192192
"targets": {{ "file.txt": {{"length": 12, "hashes": {{"sha256" : "abc"}} }} }} \
193193
}}'

0 commit comments

Comments
 (0)