fix test
This commit is contained in:
parent
96d8cb17d9
commit
51d4668763
1 changed files with 5 additions and 1 deletions
|
@ -9,6 +9,7 @@ from Crypto import Random
|
||||||
from Crypto.Cipher import AES
|
from Crypto.Cipher import AES
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
import StringIO
|
||||||
|
|
||||||
class MocBlob(object):
|
class MocBlob(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -19,6 +20,9 @@ class MocBlob(object):
|
||||||
write_func(data)
|
write_func(data)
|
||||||
return defer.succeed(True)
|
return defer.succeed(True)
|
||||||
|
|
||||||
|
def open_for_reading(self):
|
||||||
|
return StringIO.StringIO(self.data)
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
self.data += data
|
self.data += data
|
||||||
|
|
||||||
|
@ -64,7 +68,7 @@ class TestCryptBlob(unittest.TestCase):
|
||||||
|
|
||||||
# decrypt string
|
# decrypt string
|
||||||
decryptor = CryptBlob.StreamBlobDecryptor(blob, key, iv, size_of_data)
|
decryptor = CryptBlob.StreamBlobDecryptor(blob, key, iv, size_of_data)
|
||||||
decryptor.decrypt(write_func)
|
yield decryptor.decrypt(write_func)
|
||||||
self.assertEqual(self.data_buf, string_to_encrypt)
|
self.assertEqual(self.data_buf, string_to_encrypt)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
Loading…
Reference in a new issue