From 1c14845bbc366e8f32fd15cda3b2e01f8fd73966 Mon Sep 17 00:00:00 2001 From: Serhy Date: Wed, 27 Dec 2017 20:03:57 +0200 Subject: [PATCH] Fixed test_balance_and_eth_rate to verify USD balance instead of eth rate --- test/appium/tests/test_wallet.py | 6 +++--- test/appium/views/wallet.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/appium/tests/test_wallet.py b/test/appium/tests/test_wallet.py index c53f0423bd..bd7fb89ed2 100644 --- a/test/appium/tests/test_wallet.py +++ b/test/appium/tests/test_wallet.py @@ -118,7 +118,7 @@ class TestWallet(SingleDeviceTestCase): transaction_hash=transaction_hash) @pytest.mark.wallet - def test_balance_and_eth_rate(self): + def test_eth_and_currency_balance(self): errors = list() home = HomeView(self.driver) recover_access(home, @@ -128,10 +128,10 @@ class TestWallet(SingleDeviceTestCase): chats = home.get_chats() address = transaction_users_wallet['A_USER']['address'] balance = get_balance(address) / 1000000000000000000 - eth_rate = get_ethereum_price_in_usd() wallet = chats.wallet_button.click() + eth_rate = get_ethereum_price_in_usd() wallet_balance = wallet.get_eth_value() if wallet_balance != balance: errors.append('Balance %s is not equal to the expected %s' % (wallet_balance, balance)) - wallet.verify_eth_rate(eth_rate, errors) + wallet.verify_currency_balance(eth_rate, errors) assert not errors, 'errors occurred:\n{}'.format('\n'.join(errors)) diff --git a/test/appium/views/wallet.py b/test/appium/views/wallet.py index 2adfefc404..867c576c28 100644 --- a/test/appium/views/wallet.py +++ b/test/appium/views/wallet.py @@ -89,10 +89,10 @@ class WalletViewObject(BaseViewObject): def get_eth_value(self): return float(self.eth_asset.text) - def verify_eth_rate(self, expected_rate: int, errors: list): + def verify_currency_balance(self, expected_rate: int, errors: list): usd = self.get_usd_total_value() eth = self.get_eth_value() - current_rate = usd / eth - if round(current_rate, 2) != expected_rate: - errors.append('Current ETH rate %s is not equal to the expected %s' % (current_rate, expected_rate)) - logging.info('Current ETH rate %s is ok' % current_rate) + expected_usd = round(eth * expected_rate, 2) + if expected_usd != usd: + errors.append('Current USD balance %s is not equal to the expected %s' % (usd, expected_usd)) + logging.info('Current USD balance %s is ok' % usd)