Пример #1
0
def test_missing_file_argument():
    with pytest.raises(ValueError):
        aestar.AESFile(passphrase=b'12345678901234567890')
Пример #2
0
def test_both_file_and_fileobj(tmp_path):
    with pytest.raises(ValueError):
        with open(tmp_path / 'aesfile2.tmp', 'wb') as f:
            aestar.AESFile(passphrase=b'12345678901234567890',
                           file=tmp_path / 'aesfile.tmp',
                           fileobj=f)
Пример #3
0
def test_short_password_warning(short_passphrase, tmp_path):
    with pytest.warns(Warning):
        aesfile = aestar.AESFile(short_passphrase,
                                 file=tmp_path / 'aesfile.tmp')
Пример #4
0
def test_fileobj(passphrase, tmp_path):
    with open(tmp_path / 'aesfile_obj.tmp', 'wb') as f:
        aesfile = aestar.AESFile(passphrase, fileobj=f)
        aesfile.write(b'123')
        aesfile.close()
Пример #5
0
def aesfile(passphrase, tmp_path):
    return aestar.AESFile(passphrase=passphrase, file=tmp_path / 'aesfile.tmp')