-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
13 oct update. EnsRegistry class done. all tests added for test_fds_c…
…ontract and passed
- Loading branch information
1 parent
b89ef6e
commit c460357
Showing
5 changed files
with
140 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import pytest | ||
from ape.exceptions import ContractLogicError | ||
|
||
from fds.contracts.ENSRegistry import EnsRegistry | ||
|
||
|
||
def test_load_ensContract(owner, ENS): | ||
assert ENS.owner(0) == owner.address | ||
|
||
|
||
def test_set_resolver(owner, ENS): | ||
ENS.setResolver(0, owner.address) | ||
|
||
assert ENS.getResolver(0) == owner.address | ||
|
||
|
||
def test_fail_setting_resolver(owner, ENS): | ||
with pytest.raises(ContractLogicError): | ||
ENS.setResolver(1, owner.address) | ||
|
||
|
||
def test_set_owner(ENS, receiver): | ||
ENS.setOwner(0, receiver.address) | ||
|
||
assert ENS.owner(0) == receiver.address | ||
|
||
|
||
def test_fail_setting_owner(owner, ensContract, receiver): | ||
contract = ensContract | ||
|
||
ENS = EnsRegistry(receiver, contract.address) | ||
|
||
with pytest.raises(ContractLogicError): | ||
ENS.setOwner(0, owner.address) | ||
|
||
|
||
def test_set_n_get_ttl(ENS): | ||
assert ENS.getTTL(0) == 0 | ||
|
||
ENS.setTTL(0, 420) | ||
|
||
assert ENS.getTTL(0) == 420 | ||
|
||
|
||
def test_fail_setting_ttl(owner, receiver, ensContract): | ||
contract = ensContract | ||
|
||
ENS = EnsRegistry(owner, contract.address) | ||
|
||
with pytest.raises(ContractLogicError): | ||
ENS.setTTL(12, 1111) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters