defl/tests/test_pass.py

33 lines
903 B
Python
Raw Normal View History

2024-09-11 11:14:03 -04:00
#!/usr/bin/env python3
import defl
from defl import log, cl, Assert
from defl.testing_ import Tester, Test, TestState, testFail
import dataclasses, contextlib
import itertools
import inspect
from typing import *
from types import *
import typing
from defl._typeCheck_ import *
from defl._dataclass_ import *
tester = Tester(name=__file__)
@tester.add()
def test():
text = 'test'
enc = defl.gpgSymmetric(text=text, passwd="test", encrypt=True)
assert enc == bytearray(
b'-----BEGIN PGP MESSAGE-----\n\njA0ECQMIzviJ4FQ0N+370jkB1fJS4774I9f0dFGkRUds3bMbgEgtJvBaCIdiGDTy\n8HpRRDHuuLfPF164oknRlcHw/qtVSEEeJr4=\n=VZlq\n-----END PGP MESSAGE-----\n'
)
log.info('enc', lambda x: x.enc)
dec = defl.gpgSymmetric(text=enc, passwd="test", encrypt=False)
log.info('dec', lambda x: x.dec)
Assert(dec) == text.encode()
asdf
log.info(tester.run())
tester.exitWithStatus()