'Check that corruption of encrypted stream is detected.'

def testUploadWrapperCorruption(self):

    encrypted_data = ''
    count = 0
    with self.assertRaisesRegexp(IOError, 'HMAC    not    verified'):
        while 1:
            small_read = self.encrypt_wrapper.read(2)
            if (not small_read):
                break
            encrypted_data += small_read
            count += len(small_read)
            if (count == 3000):
                small_read = 'XX'
            self.decrypt_wrapper.write(small_read)
