Skip to content

Commit

Permalink
import utils from nile (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-fleming authored Oct 20, 2022
1 parent ea1ebc6 commit d0d2839
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 147 deletions.
6 changes: 2 additions & 4 deletions tests/access/OwnableBaseSuite.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import pytest
from signers import MockSigner
from utils import (
ZERO_ADDRESS,
assert_event_emitted,
)
from nile.utils import ZERO_ADDRESS
from utils import assert_event_emitted


signer = MockSigner(123456789987654321)
Expand Down
6 changes: 2 additions & 4 deletions tests/access/test_AccessControl.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import pytest
from pathlib import Path
from signers import MockSigner
from nile.utils import TRUE, FALSE, assert_revert
from utils import (
TRUE, FALSE,
assert_event_emitted, assert_revert,
get_contract_class, cached_contract,
State, Account
State, Account, assert_event_emitted, get_contract_class, cached_contract
)

DEFAULT_ADMIN_ROLE = 0
Expand Down
3 changes: 2 additions & 1 deletion tests/access/test_Ownable.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from signers import MockSigner
from utils import get_contract_class, assert_revert, cached_contract, State, Account
from nile.utils import assert_revert
from utils import State, Account, get_contract_class, cached_contract
from OwnableBaseSuite import OwnableBase


Expand Down
3 changes: 2 additions & 1 deletion tests/account/test_Account.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from signers import MockSigner, get_raw_invoke
from utils import assert_revert, get_contract_class, cached_contract, TRUE, State, Account
from nile.utils import TRUE, assert_revert
from utils import get_contract_class, cached_contract, State, Account


signer = MockSigner(123456789987654321)
Expand Down
3 changes: 2 additions & 1 deletion tests/account/test_EthAccount.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from utils import assert_revert, get_contract_class, cached_contract, TRUE, FALSE, State
from nile.utils import assert_revert, TRUE, FALSE
from utils import get_contract_class, cached_contract, State
from signers import MockEthSigner, get_raw_invoke

private_key = b'\x01' * 32
Expand Down
4 changes: 1 addition & 3 deletions tests/introspection/test_ERC165.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import pytest
from nile.utils import assert_revert, TRUE, FALSE
from utils import (
assert_revert,
get_contract_class,
cached_contract,
TRUE,
FALSE,
State
)

Expand Down
3 changes: 2 additions & 1 deletion tests/security/test_initializable.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from utils import TRUE, FALSE, assert_revert, get_contract_class, State
from nile.utils import TRUE, FALSE, assert_revert
from utils import get_contract_class, State


@pytest.mark.asyncio
Expand Down
4 changes: 2 additions & 2 deletions tests/security/test_pausable.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
from signers import MockSigner
from nile.utils import TRUE, FALSE, assert_revert
from utils import (
TRUE, FALSE, assert_revert, assert_event_emitted,
get_contract_class, cached_contract, State, Account
get_contract_class, cached_contract, assert_event_emitted, State, Account
)


Expand Down
5 changes: 2 additions & 3 deletions tests/security/test_reentrancy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
from utils import (
assert_revert, get_contract_class, State
)
from nile.utils import assert_revert
from utils import get_contract_class, State

INITIAL_COUNTER = 0

Expand Down
6 changes: 3 additions & 3 deletions tests/security/test_safemath.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest
from utils import (
from nile.utils import (
MAX_UINT256, assert_revert, add_uint, sub_uint,
mul_uint, div_rem_uint, to_uint,
get_contract_class, State
mul_uint, div_rem_uint, to_uint
)
from utils import get_contract_class, State


@pytest.fixture(scope='module')
Expand Down
2 changes: 1 addition & 1 deletion tests/signers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from starkware.starknet.services.api.gateway.transaction import InvokeFunction
from starkware.starknet.business_logic.transaction.objects import InternalTransaction, TransactionExecutionInfo
from nile.signer import Signer, from_call_to_call_array, get_transaction_hash, TRANSACTION_VERSION
from utils import to_uint
from nile.utils import to_uint
import eth_keys


Expand Down
8 changes: 5 additions & 3 deletions tests/token/erc20/ERC20BaseSuite.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pytest
from signers import MockSigner
from utils import (
from nile.utils import (
to_uint, add_uint, sub_uint, str_to_felt, MAX_UINT256, ZERO_ADDRESS,
INVALID_UINT256, TRUE, assert_revert, assert_event_emitted, assert_events_emitted,
contract_path, State
INVALID_UINT256, TRUE, assert_revert
)
from utils import (
assert_event_emitted, assert_events_emitted, contract_path, State
)


Expand Down
8 changes: 5 additions & 3 deletions tests/token/erc20/test_ERC20Burnable.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pytest
from signers import MockSigner
from nile.utils import (
add_uint, sub_uint, ZERO_ADDRESS, INVALID_UINT256, assert_revert,
)
from utils import (
add_uint, sub_uint, ZERO_ADDRESS, INVALID_UINT256,
get_contract_class, cached_contract, assert_revert, assert_event_emitted,
assert_events_emitted, State, Account
get_contract_class, cached_contract, assert_events_emitted,
assert_event_emitted, State, Account
)
from ERC20BaseSuite import (
ERC20Base, NAME, SYMBOL, DECIMALS, INIT_SUPPLY, AMOUNT, UINT_ONE, UINT_ZERO
Expand Down
7 changes: 4 additions & 3 deletions tests/token/erc20/test_ERC20Mintable.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pytest
from signers import MockSigner
from nile.utils import (
add_uint, sub_uint, MAX_UINT256, ZERO_ADDRESS, INVALID_UINT256, assert_revert
)
from utils import (
add_uint, sub_uint, MAX_UINT256, ZERO_ADDRESS, INVALID_UINT256,
get_contract_class, cached_contract, assert_revert, assert_event_emitted,
State, Account
get_contract_class, cached_contract, assert_event_emitted, State, Account
)
from ERC20BaseSuite import ERC20Base, NAME, SYMBOL, DECIMALS, INIT_SUPPLY, UINT_ONE
from access.OwnableBaseSuite import OwnableBase
Expand Down
4 changes: 2 additions & 2 deletions tests/token/erc20/test_ERC20Pausable.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
from signers import MockSigner
from nile.utils import TRUE, FALSE, assert_revert
from utils import (
TRUE, FALSE, assert_revert, get_contract_class,
cached_contract, State, Account
get_contract_class, cached_contract, State, Account
)
from ERC20BaseSuite import ERC20Base, NAME, SYMBOL, DECIMALS, INIT_SUPPLY, AMOUNT
from access.OwnableBaseSuite import OwnableBase
Expand Down
8 changes: 3 additions & 5 deletions tests/token/erc20/test_ERC20Upgradeable.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import pytest
from starkware.starknet.public.abi import get_selector_from_name
from signers import MockSigner
from utils import (
to_uint, sub_uint, str_to_felt, assert_revert, TRUE,
get_contract_class, cached_contract, State, Account,
get_selector_from_name
)
from nile.utils import to_uint, sub_uint, str_to_felt, assert_revert, TRUE
from utils import get_contract_class, cached_contract, State, Account


signer = MockSigner(123456789987654321)
Expand Down
7 changes: 5 additions & 2 deletions tests/token/erc721/ERC721BaseSuite.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import pytest
from signers import MockSigner
from utils import (
from nile.utils import (
str_to_felt, ZERO_ADDRESS, TRUE, FALSE, assert_revert, INVALID_UINT256,
assert_event_emitted, assert_events_emitted, to_uint, sub_uint, add_uint,
to_uint, sub_uint, add_uint
)
from utils import (
assert_event_emitted, assert_events_emitted,
)


Expand Down
12 changes: 8 additions & 4 deletions tests/token/erc721/test_ERC721EnumerableMintableBurnable.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import pytest
from signers import MockSigner
from nile.utils import (
MAX_UINT256, ZERO_ADDRESS, TRUE, assert_revert, to_uint, sub_uint, add_uint
)
from utils import (
MAX_UINT256, get_contract_class, cached_contract, TRUE,
assert_revert, assert_event_emitted, assert_events_emitted, to_uint,
sub_uint, add_uint, ZERO_ADDRESS, State, Account
get_contract_class, cached_contract, assert_event_emitted,
assert_events_emitted, State, Account
)
from ERC721BaseSuite import (
ERC721Base, NAME, SYMBOL, NONEXISTENT_TOKEN, DATA, RECIPIENT
)
from ERC721BaseSuite import ERC721Base, NAME, SYMBOL, NONEXISTENT_TOKEN, DATA, RECIPIENT
from access.OwnableBaseSuite import OwnableBase


Expand Down
10 changes: 6 additions & 4 deletions tests/token/erc721/test_ERC721MintableBurnable.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import pytest
from signers import MockSigner
from nile.utils import ZERO_ADDRESS, assert_revert, to_uint, sub_uint
from utils import (
ZERO_ADDRESS, assert_revert, assert_event_emitted,
assert_events_emitted, get_contract_class, cached_contract, to_uint,
sub_uint, State, Account
get_contract_class, cached_contract, assert_event_emitted,
assert_events_emitted, State, Account
)
from ERC721BaseSuite import (
ERC721Base, NAME, SYMBOL, NONEXISTENT_TOKEN, TOKENS, TOKEN
)
from ERC721BaseSuite import ERC721Base, NAME, SYMBOL, NONEXISTENT_TOKEN, TOKENS, TOKEN
from access.OwnableBaseSuite import OwnableBase


Expand Down
8 changes: 5 additions & 3 deletions tests/token/erc721/test_ERC721MintablePausable.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import pytest
from signers import MockSigner
from nile.utils import TRUE, FALSE, ZERO_ADDRESS, assert_revert, to_uint
from utils import (
str_to_felt, TRUE, FALSE, get_contract_class, cached_contract,
assert_revert, assert_event_emitted, to_uint, ZERO_ADDRESS, State, Account
get_contract_class, cached_contract, assert_event_emitted, State, Account
)
from ERC721BaseSuite import (
ERC721Base, NAME, SYMBOL, TOKENS, TOKEN, NONEXISTENT_TOKEN, DATA
)
from ERC721BaseSuite import ERC721Base, NAME, SYMBOL, TOKENS, TOKEN, NONEXISTENT_TOKEN, DATA
from access.OwnableBaseSuite import OwnableBase


Expand Down
7 changes: 4 additions & 3 deletions tests/token/erc721/test_ERC721SafeMintableMock.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pytest
from signers import MockSigner
from nile.utils import (
ZERO_ADDRESS, INVALID_UINT256, assert_revert, to_uint
)
from utils import (
ZERO_ADDRESS, INVALID_UINT256, assert_revert,
assert_event_emitted, get_contract_class, cached_contract, to_uint,
State, Account
get_contract_class, cached_contract, assert_event_emitted, State, Account
)
from ERC721BaseSuite import ERC721Base, NAME, SYMBOL, DATA, TOKEN, TOKENS
from access.OwnableBaseSuite import OwnableBase
Expand Down
7 changes: 4 additions & 3 deletions tests/upgrades/test_Proxy.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import pytest
from starkware.starknet.public.abi import get_selector_from_name
from signers import MockSigner
from nile.utils import (
assert_revert, assert_revert_entry_point
)
from utils import (
assert_revert,
get_contract_class,
cached_contract,
assert_event_emitted,
assert_revert_entry_point,
get_selector_from_name,
State,
Account
)
Expand Down
6 changes: 2 additions & 4 deletions tests/upgrades/test_upgrades.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import pytest
from signers import MockSigner
from starkware.starknet.public.abi import get_selector_from_name
from nile.utils import assert_revert, assert_revert_entry_point, FALSE, TRUE
from utils import (
State,
Account,
assert_revert,
assert_revert_entry_point,
assert_event_emitted,
get_contract_class,
cached_contract,
get_selector_from_name,
FALSE, TRUE
)


Expand Down
Loading

0 comments on commit d0d2839

Please sign in to comment.