-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[uniffi] Re-introduce
async
Python tests
This creates async tests for most of our sync tests.
- Loading branch information
Showing
6 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import asyncio | ||
|
||
from mls_rs_uniffi import Client, CipherSuite, generate_signature_keypair, client_config_default | ||
|
||
|
||
async def scenario(): | ||
client_config = client_config_default() | ||
key = await generate_signature_keypair(CipherSuite.CURVE25519_AES128) | ||
alice = Client(b'alice', key, client_config) | ||
|
||
group = await alice.create_group(None) | ||
await group.write_to_storage() | ||
|
||
|
||
asyncio.run(scenario()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from mls_rs_uniffi import CipherSuite, generate_signature_keypair | ||
import asyncio | ||
|
||
|
||
async def scenario(): | ||
signature_keypair = await generate_signature_keypair( | ||
CipherSuite.CURVE25519_AES128) | ||
assert signature_keypair.cipher_suite == CipherSuite.CURVE25519_AES128 | ||
|
||
|
||
asyncio.run(scenario()) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import asyncio | ||
|
||
from mls_rs_uniffi import CipherSuite, generate_signature_keypair, Client, \ | ||
client_config_default | ||
|
||
|
||
async def scenario(): | ||
client_config = client_config_default() | ||
client_config.use_ratchet_tree_extension = False | ||
|
||
key = await generate_signature_keypair(CipherSuite.CURVE25519_AES128) | ||
alice = Client(b'alice', key, client_config) | ||
|
||
group = await alice.create_group(None) | ||
commit = await group.commit() | ||
|
||
assert commit.ratchet_tree is not None | ||
|
||
|
||
asyncio.run(scenario()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import asyncio | ||
|
||
from mls_rs_uniffi import CipherSuite, generate_signature_keypair, Client, \ | ||
client_config_default | ||
|
||
|
||
async def scenario(): | ||
client_config = client_config_default() | ||
|
||
key = await generate_signature_keypair(CipherSuite.CURVE25519_AES128) | ||
alice = Client(b'alice', key, client_config) | ||
|
||
key = await generate_signature_keypair(CipherSuite.CURVE25519_AES128) | ||
bob = Client(b'bob', key, client_config) | ||
|
||
alice = await alice.create_group(None) | ||
message = await bob.generate_key_package_message() | ||
|
||
commit = await alice.add_members([message]) | ||
await alice.process_incoming_message(commit.commit_message) | ||
bob = (await bob.join_group(None, commit.welcome_messages[0])).group | ||
|
||
msg = await alice.encrypt_application_message(b'hello, bob') | ||
output = await bob.process_incoming_message(msg) | ||
|
||
await alice.write_to_storage() | ||
|
||
assert output.data == b'hello, bob' | ||
|
||
|
||
asyncio.run(scenario()) |