from pyi_updater.exceptions import FileCryptError
from pyi_updater.filecrypt import FileCrypt

PASSWORD = six.b('This is my password')
FILENAME = u'test.txt'
FILENAME_ENC = u'test.txt.enc'
RANDOM_DATA = u'This is some stuff that i want to test'.split(u' ')
FILE_DATA = []
LENGHTS = [8, 9, 10, 11]

for i in xrange(100):
    a = u' '.join(choice(RANDOM_DATA) for x in range(choice(LENGHTS)))
    FILE_DATA.append(a + u'\n')

setup_fc = FileCrypt()
setup_fc.data_dir = cwd
salt = os.urandom(16)
salt_version = '1'
salt_info = {
    u'salt': salt,
    'version': salt_version
    }


def setup_func():
    with open(FILENAME, u'w') as f:
        for fd in FILE_DATA:
            f.write(fd)


def teardown_func():
Ejemplo n.º 2
0
from pyi_updater.exceptions import FileCryptError
from pyi_updater.filecrypt import FileCrypt

PASSWORD = six.b('This is my password')
FILENAME = u'test.txt'
FILENAME_ENC = u'test.txt.enc'
RANDOM_DATA = u'This is some stuff that i want to test'.split(u' ')
FILE_DATA = []
LENGHTS = [8, 9, 10, 11]

for i in xrange(100):
    a = u' '.join(choice(RANDOM_DATA) for x in range(choice(LENGHTS)))
    FILE_DATA.append(a + u'\n')

setup_fc = FileCrypt()
setup_fc.data_dir = cwd
salt = os.urandom(16)
salt_version = '1'
salt_info = {u'salt': salt, 'version': salt_version}


def setup_func():
    with open(FILENAME, u'w') as f:
        for fd in FILE_DATA:
            f.write(fd)


def teardown_func():
    if os.path.exists(FILENAME):
        os.remove(FILENAME)
    if os.path.exists(FILENAME_ENC):