mirror of
https://github.com/chaintool-py/eth-erc20.git
synced 2024-12-21 15:07:33 +01:00
add strip_0x to fix address tests that fail
This commit is contained in:
parent
5bf187612a
commit
6da3f2108a
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ build/
|
||||
gmon.out
|
||||
*.egg-info
|
||||
.venv/
|
||||
.idea
|
@ -1,7 +1,9 @@
|
||||
stages:
|
||||
- test
|
||||
- run-coverage
|
||||
- slither-analyzer
|
||||
|
||||
|
||||
variables:
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||
|
||||
@ -35,8 +37,31 @@ test:
|
||||
# run tests
|
||||
- bash run_tests.sh
|
||||
|
||||
slither-analize:
|
||||
run-coverage:
|
||||
stage: test
|
||||
image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest
|
||||
script:
|
||||
- cd python
|
||||
- export PYTHONPATH=.
|
||||
- pip install --extra-index-url https://pip.grassrootseconomics.net
|
||||
--extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple
|
||||
-r requirements.txt -r test_requirements.txt
|
||||
- pip install pytest pytest-cov
|
||||
- coverage run -m pytest
|
||||
- coverage html
|
||||
- coverage report --fail-under=90
|
||||
|
||||
coverage: '/^TOTAL.+?(\d+\%)$/'
|
||||
artifacts:
|
||||
reports:
|
||||
cobertura: python/htmlcov/index.html
|
||||
|
||||
slither-analyzer:
|
||||
image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest
|
||||
allow_failure: true
|
||||
script:
|
||||
- slither solidity/
|
||||
- cd solidity
|
||||
- slither GiftableToken.sol
|
||||
- slither GiftableToken.sol --print human-summary
|
||||
|
||||
|
||||
|
BIN
python/.coverage
Normal file
BIN
python/.coverage
Normal file
Binary file not shown.
7
python/.coveragerc
Normal file
7
python/.coveragerc
Normal file
@ -0,0 +1,7 @@
|
||||
[run]
|
||||
branch = True
|
||||
[report]
|
||||
omit = .venv/*
|
||||
**/runnable/*.py
|
||||
[html]
|
||||
|
@ -94,4 +94,4 @@ class GiftableToken(TxFactory):
|
||||
tx = self.template(sender_address, contract_address, use_nonce=True)
|
||||
tx = self.set_code(tx, data)
|
||||
tx = self.finalize(tx, tx_format)
|
||||
return tx
|
||||
return tx
|
@ -12,6 +12,7 @@ from chainlib.eth.tx import (
|
||||
receipt,
|
||||
)
|
||||
from chainlib.eth.address import to_checksum_address
|
||||
from hexathon import strip_0x
|
||||
|
||||
# local imports
|
||||
from giftable_erc20_token import GiftableToken
|
||||
@ -102,7 +103,7 @@ class TestToken(EthTesterCase):
|
||||
o = transaction(tx_hash)
|
||||
r = self.rpc.do(o)
|
||||
data = c.parse_transfer_request(r['data'])
|
||||
self.assertEqual(data[0], self.accounts[1])
|
||||
self.assertEqual(data[0], strip_0x(self.accounts[1]))
|
||||
self.assertEqual(data[1], 1000)
|
||||
|
||||
|
||||
@ -124,7 +125,7 @@ class TestToken(EthTesterCase):
|
||||
o = transaction(tx_hash)
|
||||
r = self.rpc.do(o)
|
||||
data = c.parse_approve_request(r['data'])
|
||||
self.assertEqual(data[0], self.accounts[1])
|
||||
self.assertEqual(data[0], strip_0x(self.accounts[1]))
|
||||
self.assertEqual(data[1], 1000)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[1], conn=self.conn)
|
||||
@ -138,8 +139,8 @@ class TestToken(EthTesterCase):
|
||||
o = transaction(tx_hash)
|
||||
r = self.rpc.do(o)
|
||||
data = c.parse_transfer_from_request(r['data'])
|
||||
self.assertEqual(data[0], self.accounts[0])
|
||||
self.assertEqual(data[1], self.accounts[2])
|
||||
self.assertEqual(data[0], strip_0x(self.accounts[0]))
|
||||
self.assertEqual(data[1], strip_0x(self.accounts[2]))
|
||||
self.assertEqual(data[2], 1001)
|
||||
|
||||
(tx_hash, o) = c.transfer_from(self.address, self.accounts[1], self.accounts[0], self.accounts[2], 1000)
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity >0.6.11;
|
||||
pragma solidity >=0.6.11;
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-Version: 2
|
||||
|
Loading…
Reference in New Issue
Block a user