This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
105 additions
and
17 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
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
Binary file not shown.
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,65 @@ | ||
from neo.Utils.WalletFixtureTestCase import WalletFixtureTestCase | ||
from neo.Implementations.Wallets.peewee.UserWallet import UserWallet | ||
from neo.Prompt.Commands.BuildNRun import DoRun | ||
from neo.Wallets.utils import to_aes_key | ||
import binascii | ||
|
||
|
||
class SmartContractPayable(WalletFixtureTestCase): | ||
|
||
_wallet1 = None | ||
_path = "neo/SmartContract/tests/PayableTest.avm" | ||
|
||
@classmethod | ||
def GetWallet1(cls, recreate=False): | ||
if cls._wallet1 is None or recreate: | ||
cls._wallet1 = UserWallet.Open(SmartContractPayable.wallet_1_dest(), to_aes_key(SmartContractPayable.wallet_1_pass())) | ||
return cls._wallet1 | ||
|
||
def test_is_payable(self): | ||
""" | ||
Result [{'type': 'Boolean', 'value': True}] | ||
""" | ||
|
||
wallet = self.GetWallet1() | ||
|
||
arguments = [self._path, "test", "07", "01", "False", "False", "True", "payable"] | ||
|
||
with open(self._path, 'rb') as f: | ||
|
||
content = f.read() | ||
|
||
try: | ||
content = binascii.unhexlify(content) | ||
except Exception as e: | ||
pass | ||
|
||
script = content | ||
|
||
tx, result, total_ops, engine = DoRun(script, arguments, wallet, self._path) | ||
|
||
self.assertTrue(result[0].GetBoolean()) | ||
|
||
def test_is_not_payable(self): | ||
""" | ||
Result [{'type': 'Boolean', 'value': False}] | ||
""" | ||
|
||
wallet = self.GetWallet1() | ||
|
||
arguments = [self._path, "test", "07", "01", "False", "False", "False", "payable"] | ||
|
||
with open(self._path, 'rb') as f: | ||
|
||
content = f.read() | ||
|
||
try: | ||
content = binascii.unhexlify(content) | ||
except Exception as e: | ||
pass | ||
|
||
script = content | ||
|
||
tx, result, total_ops, engine = DoRun(script, arguments, wallet, self._path) | ||
|
||
self.assertFalse(result[0].GetBoolean()) |
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