From 45743444b14a7b630ef2fdffb5d182208fae043c Mon Sep 17 00:00:00 2001 From: Martin Vrachev Date: Wed, 25 Aug 2021 15:51:16 +0300 Subject: [PATCH] Remove duplicate serialization tests from test_api I was looking at how can we simplify or split test_api.py when I noticed that the test cases covered by those two test functions are already covered in the test_metadata_serialization.py module in the "invalid_keys" and "invalid_roles" datasets. Signed-off-by: Martin Vrachev --- tests/test_api.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 1d55b302..2cf12228 100755 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -28,7 +28,6 @@ Timestamp, Targets, Key, - Role, MetaFile, TargetFile, Delegations, @@ -422,49 +421,6 @@ def test_metadata_verify_delegate(self): root.verify_delegate('snapshot', snapshot) - def test_key_class(self): - keys = { - "59a4df8af818e9ed7abe0764c0b47b4240952aa0d179b5b78346c470ac30278d":{ - "keytype": "ed25519", - "keyval": { - "public": "edcd0a32a07dce33f7c7873aaffbff36d20ea30787574ead335eefd337e4dacd" - }, - "scheme": "ed25519" - }, - } - for key_dict in keys.values(): - # Test creating an instance without a required attribute. - for key in key_dict.keys(): - test_key_dict = key_dict.copy() - del test_key_dict[key] - with self.assertRaises(KeyError): - Key.from_dict("id", test_key_dict) - - - def test_role_class(self): - roles = { - "root": { - "keyids": [ - "4e777de0d275f9d28588dd9a1606cc748e548f9e22b6795b7cb3f63f98035fcb" - ], - "threshold": 1 - }, - "snapshot": { - "keyids": [ - "59a4df8af818e9ed7abe0764c0b47b4240952aa0d179b5b78346c470ac30278d" - ], - "threshold": 1 - }, - } - for role_dict in roles.values(): - # Test creating an instance without a required attribute. - for role_attr in role_dict.keys(): - test_role_dict = role_dict.copy() - del test_role_dict[role_attr] - with self.assertRaises(KeyError): - Role.from_dict(test_role_dict) - - def test_metadata_root(self): root_path = os.path.join( self.repo_dir, 'metadata', 'root.json')