@@ -75,8 +75,8 @@ def tearDownClass(cls):
75
75
76
76
def _load_key_ring (self ):
77
77
key_list = []
78
- root_key = keys .read_key (os .path .join (self .keystore_dir , 'root_key' ),
79
- 'RSA' , 'password' )
78
+ root_key = keys .RAMKey . read_from_file (os .path .join (self .keystore_dir , 'root_key' ),
79
+ 'RSA' , 'password' )
80
80
key_list .append (root_key )
81
81
82
82
for key_file in os .listdir (self .keystore_dir ):
@@ -88,8 +88,8 @@ def _load_key_ring(self):
88
88
# root key is loaded
89
89
continue
90
90
91
- key = keys .read_key (os .path .join (self .keystore_dir , key_file ), 'ED25519' ,
92
- 'password' )
91
+ key = keys .RAMKey . read_from_file (os .path .join (self .keystore_dir , key_file ),
92
+ 'ED25519' , 'password' )
93
93
key_list .append (key )
94
94
threshold = keys .Threshold (1 , 1 )
95
95
return keys .KeyRing (threshold = threshold , keys = key_list )
@@ -188,21 +188,20 @@ def test_Threshold(self):
188
188
# test default values
189
189
keys .Threshold ()
190
190
# test correct arguments
191
- keys .Threshold (min_ = 4 , max_ = 5 )
191
+ keys .Threshold (least = 4 , most = 5 )
192
192
193
193
# test incorrect input
194
- # TODO raise sslib.FormatError or ValueError instead of AssertionErrors
195
- self .assertRaises (AssertionError , keys .Threshold , 5 , 4 )
196
- self .assertRaises (AssertionError , keys .Threshold , 0 , 5 )
197
- self .assertRaises (AssertionError , keys .Threshold , 5 , 0 )
194
+ self .assertRaises (ValueError , keys .Threshold , 5 , 4 )
195
+ self .assertRaises (ValueError , keys .Threshold , 0 , 5 )
196
+ self .assertRaises (ValueError , keys .Threshold , 5 , 0 )
198
197
199
198
200
199
def test_KeyRing (self ):
201
200
key_list = []
202
- root_key = keys .read_key (os .path .join (self .keystore_dir , 'root_key' ),
203
- 'RSA' , 'password' )
204
- root_key2 = keys .read_key (os .path .join (self .keystore_dir , 'root_key2' ),
205
- 'ED25519' , 'password' )
201
+ root_key = keys .RAMKey . read_from_file (os .path .join (self .keystore_dir , 'root_key' ),
202
+ 'RSA' , 'password' )
203
+ root_key2 = keys .RAMKey . read_from_file (os .path .join (self .keystore_dir , 'root_key2' ),
204
+ 'ED25519' , 'password' )
206
205
key_list .append (root_key )
207
206
key_list .append (root_key2 )
208
207
threshold = keys .Threshold ()
@@ -211,12 +210,12 @@ def test_KeyRing(self):
211
210
self .assertEqual (keyring .keys , key_list )
212
211
213
212
214
- def test_read_key (self ):
213
+ def test_RAMKey_read_from_file (self ):
215
214
filename = os .path .join (self .keystore_dir , 'root_key' )
216
215
algorithm = 'RSA'
217
216
passphrase = 'password'
218
217
219
- self .assertTrue (isinstance (keys .read_key (filename , algorithm , passphrase ), keys .RAMKey ))
218
+ self .assertTrue (isinstance (keys .RAMKey . read_from_file (filename , algorithm , passphrase ), keys .RAMKey ))
220
219
221
220
# TODO:
222
221
# def test_RAMKey(self):
0 commit comments