Skip to content

Commit

Permalink
Fix api request to etherscan
Browse files Browse the repository at this point in the history
Signed-off-by: Serhy <sergii@status.im>
  • Loading branch information
Serhy committed Oct 2, 2019
1 parent ace4b5a commit 6037add
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions test/appium/support/api/network_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,28 @@ def __init__(self):
self.network_url = 'http://api-%s.etherscan.io/api?' % pytest.config.getoption('network')
self.faucet_url = 'https://faucet-ropsten.status.im/donate'
self.faucet_backup_url = 'https://faucet.ropsten.be/donate'
self.headers = {
'User-Agent':"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit\
/537.36 (KHTML, like Gecko) Chrome\/77.0.3865.90 Safari\/537.36", }
self.chat_bot_url = 'http://offsite.chat:8099'

def get_transactions(self, address: str) -> List[dict]:
method = self.network_url + 'module=account&action=txlist&address=0x%s&sort=desc' % address
return requests.request('GET', url=method).json()['result']
return requests.request('GET', url=method, headers=self.headers).json()['result']

def get_token_transactions(self, address: str) -> List[dict]:
method = self.network_url + 'module=account&action=tokentx&address=0x%s&sort=desc' % address
return requests.request('GET', url=method).json()['result']
return requests.request('GET', url=method, headers=self.headers).json()['result']

def is_transaction_successful(self, transaction_hash: str) -> int:
method = self.network_url + 'module=transaction&action=getstatus&txhash=%s' % transaction_hash
return not int(requests.request('GET', url=method).json()['result']['isError'])
return not int(requests.request('GET', url=method, headers=self.headers).json()['result']['isError'])

def get_balance(self, address):
method = self.network_url + 'module=account&action=balance&address=0x%s&tag=latest' % address
for i in range(5):
try:
return int(requests.request('GET', method).json()["result"])
return int(requests.request('GET', method, headers=self.headers).json()["result"])
except ValueError:
pass

Expand Down
4 changes: 2 additions & 2 deletions test/appium/tests/atomic/transactions/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_send_eth_from_wallet_to_address(self):
@marks.testrail_id(5325)
@marks.critical
def test_send_stt_from_wallet(self):
recipient = basic_user
recipient = transaction_recipients['F']
sender = transaction_senders['Q']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'])
Expand Down Expand Up @@ -369,7 +369,7 @@ def test_modify_transaction_fee_values(self):
send_transaction.sign_with_password.click_until_presence_of_element(send_transaction.enter_password_input)
send_transaction.enter_password_input.send_keys(common_password)
send_transaction.sign_button.click()
send_transaction.element_by_text('intrinsic gas too low', 'text').wait_for_visibility_of_element()
send_transaction.element_by_text('intrinsic gas too low', 'text').wait_for_visibility_of_element(20)
send_transaction.ok_button.click()

send_transaction.sign_transaction_button.click()
Expand Down

0 comments on commit 6037add

Please sign in to comment.