This commit is contained in:
Kay Kurokawa 2017-09-29 14:43:29 -04:00
parent 96d8cb17d9
commit 51d4668763

View file

@ -9,6 +9,7 @@ from Crypto import Random
from Crypto.Cipher import AES
import random
import string
import StringIO
class MocBlob(object):
def __init__(self):
@ -19,6 +20,9 @@ class MocBlob(object):
write_func(data)
return defer.succeed(True)
def open_for_reading(self):
return StringIO.StringIO(self.data)
def write(self, data):
self.data += data
@ -64,7 +68,7 @@ class TestCryptBlob(unittest.TestCase):
# decrypt string
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)
@defer.inlineCallbacks