Rehabilitate tests

This commit is contained in:
nolash 2021-10-24 15:58:01 +02:00
parent 4d1da0c7c7
commit e289ad09ca
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 33 additions and 0 deletions

View File

@ -85,6 +85,18 @@ class TokenUniqueSymbolIndex(TxFactory):
return tx
def add_writer(self, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC, id_generator=None):
enc = ABIContractEncoder()
enc.method('addWriter')
enc.typ(ABIContractType.ADDRESS)
enc.address(address)
data = enc.get()
tx = self.template(sender_address, contract_address, use_nonce=True)
tx = self.set_code(tx, data)
tx = self.finalize(tx, tx_format)
return tx
def address_of(self, contract_address, token_symbol, sender_address=ZERO_ADDRESS, id_generator=None):
j = JSONRPCRequest(id_generator)
o = j.template()

14
python/run_tests.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
set -x
default_pythonpath=$PYTHONPATH:.
export PYTHONPATH=${default_pythonpath:-.}
for f in `ls tests/*.py`; do
python $f
if [ $? -gt 0 ]; then
exit 1
fi
done
set +x
set +e

View File

@ -45,6 +45,13 @@ class TestTokenUniqueSymbolIndex(TestAddressDeclaratorBase):
self.token_index_address = r['contract_address']
(tx_hash_hex, o) = c.add_writer(self.token_index_address, self.accounts[0], self.accounts[0])
self.rpc.do(o)
o = receipt(tx_hash_hex)
r = self.rpc.do(o)
self.assertEqual(r['status'], 1)
def test_register(self):
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)