Skip to content

Commit 8872e63

Browse files
committed
more test cases in test_roundtrip of encrypter decrypter
1 parent 2b9ba15 commit 8872e63

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

Diff for: tests/core/test_signing.py

+31-3
Original file line numberDiff line numberDiff line change
@@ -1211,8 +1211,6 @@ def test_decrypter():
12111211
assert desalter.qb64b == saltqb64b
12121212
assert desalter.code == MtrDex.Salt_128
12131213

1214-
1215-
12161214
""" Done Test """
12171215

12181216
def test_roundtrip():
@@ -1237,8 +1235,38 @@ def test_roundtrip():
12371235
assert encrypter.raw == pubkey
12381236

12391237

1240-
# Test cipher qb2 (always L0 when qb2)
1238+
# Test cipher qb64 lead 0
1239+
plain = "The quick brown fox jumps over the lazy "
1240+
tin = core.Texter(text=plain) # texter in
1241+
# create cipher using Encrypter
1242+
cipher = encrypter.encrypt(prim=tin, code=CiXDex.X25519_Cipher_QB64_L0)
1243+
assert cipher.code == CiXDex.X25519_Cipher_QB64_L0
1244+
# decrypt cipher using Decrypter
1245+
tout = decrypter.decrypt(cipher=cipher, klas=core.Texter) # texter out
1246+
assert tout.text == tin.text
1247+
1248+
# Test cipher qb64 lead 1
1249+
plain = "The quick brown fox jumps over the lazy dogcats"
1250+
tin = core.Texter(text=plain) # texter in
1251+
# create cipher using Encrypter
1252+
cipher = encrypter.encrypt(prim=tin, code=CiXDex.X25519_Cipher_QB64_L0)
1253+
assert cipher.code == CiXDex.X25519_Cipher_QB64_L1
1254+
# decrypt cipher using Decrypter
1255+
tout = decrypter.decrypt(cipher=cipher, klas=core.Texter) # texter out
1256+
assert tout.text == tin.text
1257+
1258+
# Test cipher qb64 lead 2
1259+
plain = "The quick brown fox jumps over the lazy dog"
1260+
tin = core.Texter(text=plain) # texter in
1261+
# create cipher using Encrypter
1262+
cipher = encrypter.encrypt(prim=tin, code=CiXDex.X25519_Cipher_QB64_L0)
1263+
assert cipher.code == CiXDex.X25519_Cipher_QB64_L2
1264+
# decrypt cipher using Decrypter
1265+
tout = decrypter.decrypt(cipher=cipher, klas=core.Texter) # texter out
1266+
assert tout.text == tin.text
1267+
12411268

1269+
# Test cipher qb2 (always L0 when qb2)
12421270
plain = "The quick brown fox jumps over the lazy dog"
12431271
tin = core.Texter(text=plain) # texter in
12441272
# create cipher using Encrypter

0 commit comments

Comments
 (0)