@@ -17,7 +17,7 @@ def test_key_from_memory_with_bad_args(self):
1717 xmlsec .Key .from_memory (1 , format = "" )
1818
1919 def test_key_from_memory_invalid_data (self ):
20- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot load key.*' ):
20+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot load key.*' ):
2121 xmlsec .Key .from_memory (b'foo' , format = consts .KeyDataFormatPem )
2222
2323 def test_key_from_file (self ):
@@ -29,7 +29,7 @@ def test_key_from_file_with_bad_args(self):
2929 xmlsec .Key .from_file (1 , format = "" )
3030
3131 def test_key_from_invalid_file (self ):
32- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot read key.*' ):
32+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot read key.*' ):
3333 with tempfile .NamedTemporaryFile () as tmpfile :
3434 tmpfile .write (b'foo' )
3535 xmlsec .Key .from_file (tmpfile .name , format = consts .KeyDataFormatPem )
@@ -42,7 +42,7 @@ def test_key_from_fileobj(self):
4242 def test_key_from_invalid_fileobj (self ):
4343 with tempfile .NamedTemporaryFile (delete = False ) as tmpfile :
4444 tmpfile .write (b'foo' )
45- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot read key.*' ), open (tmpfile .name ) as fp :
45+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot read key.*' ), open (tmpfile .name ) as fp :
4646 xmlsec .Key .from_file (fp , format = consts .KeyDataFormatPem )
4747
4848 def test_generate (self ):
@@ -54,7 +54,7 @@ def test_generate_with_bad_args(self):
5454 xmlsec .Key .generate (klass = "" , size = "" , type = "" )
5555
5656 def test_generate_invalid_size (self ):
57- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot generate key.*' ):
57+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot generate key.*' ):
5858 xmlsec .Key .generate (klass = consts .KeyDataAes , size = 0 , type = consts .KeyDataTypeSession )
5959
6060 def test_from_binary_file (self ):
@@ -66,7 +66,7 @@ def test_from_binary_file_with_bad_args(self):
6666 xmlsec .Key .from_binary_file (klass = "" , filename = 1 )
6767
6868 def test_from_invalid_binary_file (self ):
69- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot read key.*' ):
69+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot read key.*' ):
7070 with tempfile .NamedTemporaryFile () as tmpfile :
7171 tmpfile .write (b'foo' )
7272 xmlsec .Key .from_binary_file (klass = consts .KeyDataDes , filename = tmpfile .name )
@@ -80,7 +80,7 @@ def test_from_binary_data_with_bad_args(self):
8080 xmlsec .Key .from_binary_data (klass = "" , data = 1 )
8181
8282 def test_from_invalid_binary_data (self ):
83- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot read key.*' ):
83+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot read key.*' ):
8484 xmlsec .Key .from_binary_data (klass = consts .KeyDataDes , data = b'' )
8585
8686 def test_load_cert_from_file (self ):
@@ -97,7 +97,7 @@ def test_load_cert_from_file_with_bad_args(self):
9797 def test_load_cert_from_invalid_file (self ):
9898 key = xmlsec .Key .from_file (self .path ("rsakey.pem" ), format = consts .KeyDataFormatPem )
9999 self .assertIsNotNone (key )
100- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot load cert.*' ):
100+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot load cert.*' ):
101101 with tempfile .NamedTemporaryFile () as tmpfile :
102102 tmpfile .write (b'foo' )
103103 key .load_cert_from_file (tmpfile .name , format = consts .KeyDataFormatPem )
@@ -119,7 +119,7 @@ def test_load_cert_from_invalid_fileobj(self):
119119 self .assertIsNotNone (key )
120120 with tempfile .NamedTemporaryFile (delete = False ) as tmpfile :
121121 tmpfile .write (b'foo' )
122- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot load cert.*' ), open (tmpfile .name ) as fp :
122+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot load cert.*' ), open (tmpfile .name ) as fp :
123123 key .load_cert_from_file (fp , format = consts .KeyDataFormatPem )
124124
125125 def test_load_cert_from_memory (self ):
@@ -136,7 +136,7 @@ def test_load_cert_from_memory_with_bad_args(self):
136136 def test_load_cert_from_memory_invalid_data (self ):
137137 key = xmlsec .Key .from_file (self .path ("rsakey.pem" ), format = consts .KeyDataFormatPem )
138138 self .assertIsNotNone (key )
139- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot load cert.*' ):
139+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot load cert.*' ):
140140 key .load_cert_from_memory (b'' , format = consts .KeyDataFormatPem )
141141
142142 def test_get_name (self ):
@@ -190,7 +190,7 @@ def test_load_cert(self):
190190 def test_load_cert_with_bad_args (self ):
191191 mngr = xmlsec .KeysManager ()
192192 mngr .add_key (xmlsec .Key .from_file (self .path ("rsakey.pem" ), format = consts .KeyDataFormatPem ))
193- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot load cert.*' ):
193+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot load cert.*' ):
194194 with tempfile .NamedTemporaryFile () as tmpfile :
195195 tmpfile .write (b'foo' )
196196 mngr .load_cert (tmpfile .name , format = consts .KeyDataFormatPem , type = consts .KeyDataTypeTrusted )
@@ -215,7 +215,7 @@ def test_load_cert_from_memory_with_bad_args(self):
215215 def test_load_cert_from_memory_invalid_data (self ):
216216 mngr = xmlsec .KeysManager ()
217217 mngr .add_key (xmlsec .Key .from_file (self .path ("rsakey.pem" ), format = consts .KeyDataFormatPem ))
218- with self .assertRaisesRegex (xmlsec .InternalError , '.*cannot load cert.*' ):
218+ with self .assertRaisesRegex (xmlsec .Error , '.*cannot load cert.*' ):
219219 mngr .load_cert_from_memory (b'' , format = consts .KeyDataFormatPem , type = consts .KeyDataTypeTrusted )
220220
221221 def test_load_invalid_key (self ):
0 commit comments