-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconftest.py
115 lines (75 loc) · 2.25 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/python3
import pytest
from brownie import (
NPC,
CurrentThing,
ERC721TokenReceiverImplementation,
Indoctrinator,
accounts,
Vote
)
@pytest.fixture(scope="function", autouse=True)
def isolate(fn_isolation):
# perform a chain rewind after completing each test, to ensure proper isolation
# https://eth-brownie.readthedocs.io/en/v1.10.3/tests-pytest-intro.html#isolation-fixtures
pass
@pytest.fixture(scope="module")
def thing(CurrentThing, deployer):
thing = CurrentThing.deploy({"from": deployer})
thing.mint(deployer, 10**18, {"from": deployer})
return thing
@pytest.fixture(scope="module")
def npc(NPC, deployer, thing):
nft = NPC.deploy({"from": deployer})
thing.admin_set_npc_addr(nft, {"from": deployer})
return nft
@pytest.fixture(scope="module")
def npc_minted(npc, deployer):
npc.mint(deployer)
return npc
@pytest.fixture(scope="module")
def root():
return ""
@pytest.fixture(scope="module")
def deployer():
return accounts[0]
@pytest.fixture(scope="module")
def alice():
return accounts[1]
@pytest.fixture(scope="module")
def bob():
return accounts[2]
@pytest.fixture(scope="module")
def charlie():
return accounts[3]
@pytest.fixture(scope="module")
def token(npc):
return npc
@pytest.fixture(scope="module")
def minted(npc, alice):
npc.mint(alice)
return npc
@pytest.fixture(scope="module")
def minted_token_id():
return 0
@pytest.fixture(scope="module")
def premint():
return 100
@pytest.fixture(scope="module")
def minter(npc, deployer, thing, premint, accounts, alice):
minter = Indoctrinator.deploy({"from": deployer})
npc.set_minter(minter, {"from": deployer})
minter.admin_set_nft_addr(npc, {"from": deployer})
minter.premint(accounts[0])
thing.admin_set_minter(minter, {"from": deployer})
minter.admin_set_token_addr(thing, {"from": deployer})
return minter
@pytest.fixture(scope="module")
def token_metadata():
return {"name": "NPC-ers", "symbol": "NPC"}
@pytest.fixture(scope="module")
def tokenReceiver(deployer):
return ERC721TokenReceiverImplementation.deploy({"from": deployer})
@pytest.fixture(scope="module")
def staker(npc, thing, alice):
return Vote.deploy({'from': alice})