33
44"""
55
6+ import pytest
7+ import secrets
8+
69from convex_api import (
710 Account ,
811 API ,
1114
1215TEST_ACCOUNT_NAME = 'test.convex-api'
1316
17+ @pytest .fixture
18+ def account_name ():
19+ return f'{ TEST_ACCOUNT_NAME } -{ secrets .token_hex (8 )} '
20+
1421def test_account_api_create_account (convex_url ):
1522
1623 convex = API (convex_url )
@@ -33,26 +40,26 @@ def test_account_api_multi_create_account(convex_url):
3340 assert (account_1 .address != account_2 .address )
3441
3542
36- def test_account_name (convex_url , test_key_pair_info ):
43+ def test_account_name (convex_url , test_key_pair_info , account_name ):
3744 convex = API (convex_url )
3845 import_key_pair = KeyPair .import_from_bytes (test_key_pair_info ['private_bytes' ])
39- if convex .resolve_account_name (TEST_ACCOUNT_NAME ):
40- account = convex .load_account (TEST_ACCOUNT_NAME , import_key_pair )
46+ if convex .resolve_account_name (account_name ):
47+ account = convex .load_account (account_name , import_key_pair )
4148 else :
4249 account = convex .create_account (import_key_pair )
4350 convex .topup_account (account )
44- account = convex .register_account_name (TEST_ACCOUNT_NAME , account )
51+ account = convex .register_account_name (account_name , account )
4552 assert (account .address )
4653 assert (account .name )
47- assert (account .name == TEST_ACCOUNT_NAME )
48- assert (convex .resolve_account_name (TEST_ACCOUNT_NAME ) == account .address )
54+ assert (account .name == account_name )
55+ assert (convex .resolve_account_name (account_name ) == account .address )
4956
5057
51- def test_account_setup_account (convex_url , test_key_pair_info ):
58+ def test_account_setup_account (convex_url , test_key_pair_info , account_name ):
5259 convex = API (convex_url )
5360 import_key_pair = KeyPair .import_from_bytes (test_key_pair_info ['private_bytes' ])
54- account = convex .setup_account (TEST_ACCOUNT_NAME , import_key_pair )
61+ account = convex .setup_account (account_name , import_key_pair )
5562 assert (account .address )
5663 assert (account .name )
57- assert (account .name == TEST_ACCOUNT_NAME )
58- assert (convex .resolve_account_name (TEST_ACCOUNT_NAME ) == account .address )
64+ assert (account .name == account_name )
65+ assert (convex .resolve_account_name (account_name ) == account .address )
0 commit comments