Skip to content

Commit d9ae0ef

Browse files
committed
rename create_new to create
1 parent 6c0da1d commit d9ae0ef

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

convex_api/account.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def address_checksum(self):
133133
return to_address_checksum(self.address)
134134

135135
@staticmethod
136-
def create_new():
136+
def create():
137137
"""
138138
Create a new account with a random key and address
139139
@@ -143,9 +143,9 @@ def create_new():
143143
return Account(Ed25519PrivateKey.generate())
144144

145145
@staticmethod
146-
def create_from_bytes(value):
146+
def import_from_bytes(value):
147147
"""
148-
Create the an account from a private key in bytes.
148+
Import an account from a private key in bytes.
149149
150150
:returns: Account object with the private/public key
151151

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_account_info():
4343

4444
@pytest.fixture(scope='module')
4545
def test_account(test_account_info):
46-
return Account.create_from_bytes(test_account_info['private_bytes'])
46+
return Account.import_from_bytes(test_account_info['private_bytes'])
4747

4848
@pytest.fixture(scope='module')
4949
def convex_url():
@@ -56,6 +56,6 @@ def convex(convex_url):
5656

5757
@pytest.fixture(scope='module')
5858
def other_account(convex):
59-
account = Account.create_new()
59+
account = Account.create()
6060
convex.topup_account(account)
6161
return account

tests/intergration/test_convex_api.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ def test_convex_api_request_funds(convex_url, test_account):
4141

4242
def test_convex_api_topup_account(convex_url):
4343
convex = ConvexAPI(convex_url)
44-
account = Account.create_new()
44+
account = Account.create()
4545
topup_amount = TEST_FUNDING_AMOUNT
4646
amount = convex.topup_account(account, topup_amount)
4747
assert(amount >= topup_amount)
4848

49-
account = Account.create_new()
49+
account = Account.create()
5050
amount = convex.topup_account(account)
5151
assert(amount >= 0)
5252

@@ -59,7 +59,7 @@ def test_convex_get_account_info(convex_url, test_account):
5959
assert(info['sequence'] > 0)
6060

6161

62-
account = Account.create_new()
62+
account = Account.create()
6363
with pytest.raises(ConvexRequestError, match='Address does not exist'):
6464
info = convex.get_account_info(account)
6565

@@ -86,21 +86,21 @@ def test_convex_api_send_basic_scrypt(convex_url, test_account):
8686

8787
def test_convex_api_get_balance_no_funds(convex_url):
8888
convex = ConvexAPI(convex_url)
89-
account = Account.create_new()
89+
account = Account.create()
9090
new_balance = convex.get_balance(account)
9191
assert(new_balance == 0)
9292

9393
def test_convex_api_get_balance_small_funds(convex_url, test_account):
9494
convex = ConvexAPI(convex_url)
95-
account = Account.create_new()
95+
account = Account.create()
9696
amount = 100
9797
request_amount = convex.request_funds(amount, account)
9898
new_balance = convex.get_balance(account)
9999
assert(new_balance == amount)
100100

101101
def test_convex_api_get_balance_new_account(convex_url):
102102
convex = ConvexAPI(convex_url)
103-
account = Account.create_new()
103+
account = Account.create()
104104
amount = TEST_FUNDING_AMOUNT
105105
request_amount = convex.request_funds(amount, account)
106106
assert(request_amount == amount)
@@ -122,7 +122,7 @@ def test_convex_api_call(convex_url):
122122
)
123123
"""
124124
convex = ConvexAPI(convex_url)
125-
account = Account.create_new()
125+
account = Account.create()
126126
amount = TEST_FUNDING_AMOUNT
127127
request_amount = convex.request_funds(amount, account)
128128
result = convex.send(deploy_storage, account)
@@ -158,8 +158,8 @@ def test_convex_api_call(convex_url):
158158

159159
def test_convex_api_transfer(convex_url):
160160
convex = ConvexAPI(convex_url)
161-
account_from = Account.create_new()
162-
account_to = Account.create_new()
161+
account_from = Account.create()
162+
account_to = Account.create()
163163
amount = TEST_FUNDING_AMOUNT
164164
request_amount = convex.request_funds(amount, account_from)
165165
assert(request_amount == amount)

tests/unit/test_account.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@
1919
SIGN_HASH_TEXT = '5bb1ce718241bfec110552b86bb7cccf0d95b8a5f462fbf6dff7c48543622ba5'
2020
SIGN_TEXT = '0x7eceffab47295be3891ea745838a99102bfaf525ec43632366c7ec3f54db4822b5d581573aecde94c420554f963baebbf412e4304ad8636886ddfa7b1049f70e'
2121
def test_account_create_new():
22-
account = Account.create_new()
22+
account = Account.create()
2323
assert(account)
2424
assert(account.address)
2525

2626

2727
def test_account_create_from_bytes(test_account_info):
28-
account = Account.create_from_bytes(test_account_info['private_bytes'])
28+
account = Account.import_from_bytes(test_account_info['private_bytes'])
2929
assert(account)
3030
assert(account.address == test_account_info['address'])
3131

3232
def test_account_address_bytes(test_account_info):
33-
account = Account.create_from_bytes(test_account_info['private_bytes'])
33+
account = Account.import_from_bytes(test_account_info['private_bytes'])
3434
assert(account)
3535
assert(account.address_bytes == to_bytes(hexstr=test_account_info['address']))
3636

3737
def test_account_address_api(test_account_info):
38-
account = Account.create_from_bytes(test_account_info['private_bytes'])
38+
account = Account.import_from_bytes(test_account_info['private_bytes'])
3939
assert(account)
4040
assert(account.address_api == remove_0x_prefix(test_account_info['address']))
4141

4242
def test_account_address_checksum(test_account_info):
43-
account = Account.create_from_bytes(test_account_info['private_bytes'])
43+
account = Account.import_from_bytes(test_account_info['private_bytes'])
4444
assert(account)
4545
assert(account.address_checksum.lower() == test_account_info['address'])
4646

4747
def test_account_sign(test_account_info):
4848
hash_text = SIGN_HASH_TEXT
49-
account = Account.create_from_bytes(test_account_info['private_bytes'])
49+
account = Account.import_from_bytes(test_account_info['private_bytes'])
5050
sign_data = account.sign(hash_text)
5151
assert(sign_data == SIGN_TEXT)
5252

0 commit comments

Comments
 (0)