Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sajanrajdev committed Mar 31, 2022
1 parent 1ba4936 commit 7d0fe77
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion _setup/StrategyResolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def confirm_harvest(self, before, after, tx):
"bOxSolid", "strategist"
)

assert event["token"] == self.manager.strategy.bBveOxd_Oxd()
assert event["token"] == self.manager.strategy.bOxSolid()
assert event["amount"] == after.balances(
"bOxSolid", "badgerTree"
) - before.balances("bOxSolid", "badgerTree")
2 changes: 1 addition & 1 deletion _setup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
WANT = "0x6519546433dCB0a34A0De908e1032c46906EF664"

## Account that has a lot of want (we will "borrow it" for testing)
WHALE_ADDRESS = "0x53D8EDF6a54239eB785eC72213919Fb6b6B73598"
WHALE_ADDRESS = "0x6e070e66f65ced97439a60c1e775ca41f12ea155"

## Address for Badger Registry, used to fill in default addresses
## See: https://github.com/Badger-Finance/badger-registry
Expand Down
4 changes: 0 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ def deployed(

vault.setStrategy(strategy, {"from": governance})

# Fastforward a few hours for emissions to kick in
chain.sleep(3600 * 24) # 1 day
chain.mine(50)

return DotMap(
deployer=deployer,
vault=vault,
Expand Down
8 changes: 7 additions & 1 deletion tests/functional/test_are_you_trying.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def test_are_you_trying(deployer, vault, strategy, want, governance):
# Confirm that userProxy has been generated after first deposit
assert strategy.getUserProxy() != AddressZero

chain.sleep(10000 * 13) # Mine so we get some interest
chain.sleep(100000 * 13) # Mine so we get some interest
chain.mine(1) # Mine so we get some interest

## TEST 1: Does the want get used in any way?
assert want.balanceOf(vault) == depositAmount - available
Expand All @@ -48,6 +49,11 @@ def test_are_you_trying(deployer, vault, strategy, want, governance):
# Use this if it should invest all
assert want.balanceOf(strategy) == 0

# Check that rewards have been earned
# stakingContract = interface.IMultiRewards(strategy.stakingAddress())
print("Ratio:", strategy.getSolidlyPoolRatio(strategy.OXD(), strategy.BVEOXD(), False))
print("Earned:", strategy.balanceOfRewards())

## TEST 2: Is the Harvest profitable?
harvest = strategy.harvest({"from": governance})
event = harvest.events["Harvested"]
Expand Down
5 changes: 4 additions & 1 deletion tests/functional/test_does_it_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_is_profitable(vault, strategy, want, randomUser, deployer):

snap.settEarn({"from": settKeeper})

chain.sleep(15)
chain.sleep(15000)
chain.mine(1)

strategy.harvest({"from": settKeeper})
Expand Down Expand Up @@ -66,6 +66,9 @@ def test_is_acceptable_apr(vault, strategy, want, keeper, deployer):
# Earn
snap.settEarn({"from": keeper})

chain.sleep(15000)
chain.mine(1)

# Harvest
strategy.harvest({"from": keeper})

Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_strategy_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def test_strategy_action_permissions(deployer, vault, strategy, want, keeper):
# withdrawToVault onlyVault
for actor in actorsToCheck:
if actor == strategy.governance() or actor == strategy.strategist():
chain.snapshot()
vault.withdrawToVault({"from": actor})
chain.revert()
else:
with brownie.reverts("onlyGovernanceOrStrategist"):
vault.withdrawToVault({"from": actor})
Expand All @@ -98,7 +100,9 @@ def test_strategy_action_permissions(deployer, vault, strategy, want, keeper):
# withdrawOther _onlyNotProtectedTokens
for actor in actorsToCheck:
if actor == strategy.governance() or actor == strategy.strategist():
chain.snapshot()
vault.sweepExtraToken(vault, {"from": actor})
chain.revert()
else:
with brownie.reverts("onlyGovernanceOrStrategist"):
vault.sweepExtraToken(vault, {"from": actor})
Expand Down

0 comments on commit 7d0fe77

Please sign in to comment.