1
- import os
2
1
import tempfile
3
2
4
3
from lxml import etree
@@ -125,7 +124,7 @@ def test_encrypt_binary(self):
125
124
126
125
encrypted = ctx .encrypt_binary (enc_data , b'test' )
127
126
self .assertIsNotNone (encrypted )
128
- self .assertEqual ("{%s}%s" % (consts .EncNs , consts .NodeEncryptedData ), encrypted .tag )
127
+ self .assertEqual ("{{{}}}{}" . format (consts .EncNs , consts .NodeEncryptedData ), encrypted .tag )
129
128
130
129
enc_method = xmlsec .tree .find_child (enc_data , consts .NodeEncryptionMethod , consts .EncNs )
131
130
self .assertIsNotNone (enc_method )
@@ -170,7 +169,7 @@ def test_encrypt_uri(self):
170
169
171
170
encrypted = ctx .encrypt_binary (enc_data , 'file://' + tmpfile .name )
172
171
self .assertIsNotNone (encrypted )
173
- self .assertEqual ("{%s}%s" % (consts .EncNs , consts .NodeEncryptedData ), encrypted .tag )
172
+ self .assertEqual ("{{{}}}{}" . format (consts .EncNs , consts .NodeEncryptedData ), encrypted .tag )
174
173
175
174
enc_method = xmlsec .tree .find_child (enc_data , consts .NodeEncryptionMethod , consts .EncNs )
176
175
self .assertIsNotNone (enc_method )
@@ -219,7 +218,7 @@ def test_decrypt_key(self):
219
218
self .assertEqual (self .load_xml ("enc3-in.xml" ), decrypted )
220
219
221
220
def check_decrypt (self , i ):
222
- root = self .load_xml ('enc%d -out.xml' % i )
221
+ root = self .load_xml ('enc{} -out.xml' . format ( i ) )
223
222
enc_data = xmlsec .tree .find_child (root , consts .NodeEncryptedData , consts .EncNs )
224
223
self .assertIsNotNone (enc_data )
225
224
@@ -228,7 +227,7 @@ def check_decrypt(self, i):
228
227
ctx = xmlsec .EncryptionContext (manager )
229
228
decrypted = ctx .decrypt (enc_data )
230
229
self .assertIsNotNone (decrypted )
231
- self .assertEqual (self .load_xml ("enc%d -in.xml" % i ), root )
230
+ self .assertEqual (self .load_xml ("enc{} -in.xml" . format ( i ) ), root )
232
231
233
232
def test_decrypt_bad_args (self ):
234
233
ctx = xmlsec .EncryptionContext ()
0 commit comments