-
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.
11 oct update fds_tx done. tests done till test_pay
- Loading branch information
1 parent
41a7f0d
commit 868582a
Showing
8 changed files
with
201 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,60 @@ | ||
from fds.fds_tx import Tx | ||
|
||
|
||
def test_get_contract(sender, owner, solidity_contract_instance, ABI): | ||
contract_address = solidity_contract_instance.address | ||
|
||
tx_object = Tx(owner) | ||
deployed_contract = tx_object.getContract(sender, contract_address, ABI) | ||
|
||
assert deployed_contract.address == contract_address | ||
assert deployed_contract.balance == 0 | ||
assert deployed_contract.owner() == owner | ||
|
||
# * test contract method | ||
assert deployed_contract.getCount() == 0 | ||
deployed_contract.increment(sender=sender) | ||
assert deployed_contract.count() == 1 | ||
|
||
|
||
def test_deploy_contract(owner, solidity_contract_container): | ||
tx_object = Tx(owner) | ||
contract = tx_object.deployContract(solidity_contract_container) | ||
|
||
assert contract.balance == 0 | ||
assert contract.owner() == owner | ||
|
||
# * test contract method | ||
assert contract.getCount() == 0 | ||
contract.increment(sender=owner) | ||
assert contract.count() == 1 | ||
|
||
|
||
def test_syncNonce(sender, receiver): | ||
tx_object = Tx(sender) | ||
|
||
nonce = tx_object.syncNonce() | ||
|
||
assert isinstance(nonce, int) | ||
|
||
assert nonce == 0 | ||
|
||
# if it's possible send some tx to increase eth balance | ||
# print(sender.balance) | ||
sender.transfer(receiver, "10 ether") | ||
|
||
assert tx_object.syncNonce() > 0 | ||
|
||
|
||
def test_pay(sender, receiver): | ||
tx_object = Tx(sender) | ||
|
||
receipt = tx_object.pay( | ||
to_address=receiver.address, | ||
amount="0.1 ether", | ||
) | ||
|
||
assert receipt | ||
assert receipt.data.hex() == "0x" | ||
# assert receipt.to == receiver.address | ||
assert receipt.gas_used > 0 |
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