tests/Node.py
def validateFunds(self, initialBalances, transferAmount, source, accounts):
        """Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal."""
        assert(source)
        assert(isinstance(source, Account))
        assert(accounts)
        assert(isinstance(accounts, list))
        assert(len(accounts) > 0)
        assert(initialBalances)
        assert(isinstance(initialBalances, dict))
        assert(isinstance(transferAmount, int))

        currentBalances=self.getEnuBalances([source] + accounts)
        assert(currentBalances)
        assert(isinstance(currentBalances, dict))
        assert(len(initialBalances) == len(currentBalances))

        if len(currentBalances) != len(initialBalances):
            Utils.Print("ERROR: validateFunds> accounts length mismatch. Initial: %d, current: %d" % (len(initialBalances), len(currentBalances)))
            return False

        for key, value in currentBalances.items():
            initialBalance = initialBalances[key]
            assert(initialBalances)
            expectedInitialBalance = value - transferAmount
            if key is source:
                expectedInitialBalance = value + (transferAmount*len(accounts))

            if (initialBalance != expectedInitialBalance):
                Utils.Print("ERROR: validateFunds> Expected: %d, actual: %d for account %s" %
                            (expectedInitialBalance, initialBalance, key.name))
                return False
Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal.
Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal.
Validate each account has the expected MES balance . Validate cumulative balance matches expectedTotal .
def validateFunds(self, initialBalances, transferAmount, source, accounts):
        assert(source)
        assert(isinstance(source, Account))
        assert(accounts)
        assert(isinstance(accounts, list))
        assert(len(accounts) > 0)
        assert(initialBalances)
        assert(isinstance(initialBalances, dict))
        assert(isinstance(transferAmount, int))
        currentBalances=self.getEnuBalances([source] + accounts)
        assert(currentBalances)
        assert(isinstance(currentBalances, dict))
        assert(len(initialBalances) == len(currentBalances))
        if len(currentBalances) != len(initialBalances):
            Utils.Print("ERROR: validateFunds> accounts length mismatch. Initial: %d, current: %d" % (len(initialBalances), len(currentBalances)))
            return False
        for key, value in currentBalances.items():
            initialBalance = initialBalances[key]
            assert(initialBalances)
            expectedInitialBalance = value - transferAmount
            if key is source:
                expectedInitialBalance = value + (transferAmount*len(accounts))
            if (initialBalance != expectedInitialBalance):
                Utils.Print("ERROR: validateFunds> Expected: %d, actual: %d for account %s" %
                            (expectedInitialBalance, initialBalance, key.name))
                return False
def validateFunds ( self , initialBalances , transferAmount , source , accounts ) : assert ( source ) assert ( isinstance ( source , Account ) ) assert ( accounts ) assert ( isinstance ( accounts , list ) ) assert ( len ( accounts ) > 0 ) assert ( initialBalances ) assert ( isinstance ( initialBalances , dict ) ) assert ( isinstance ( transferAmount , int ) ) currentBalances = self . getEnuBalances ( [ source ] + accounts ) assert ( currentBalances ) assert ( isinstance ( currentBalances , dict ) ) assert ( len ( initialBalances ) == len ( currentBalances ) ) if len ( currentBalances ) != len ( initialBalances ) : Utils . Print ( "ERROR: validateFunds> accounts length mismatch. Initial: %d, current: %d" % ( len ( initialBalances ) , len ( currentBalances ) ) ) return False for key , value in currentBalances . items ( ) : initialBalance = initialBalances [ key ] assert ( initialBalances ) expectedInitialBalance = value - transferAmount if key is source : expectedInitialBalance = value + ( transferAmount * len ( accounts ) ) if ( initialBalance != expectedInitialBalance ) : Utils . Print ( "ERROR: validateFunds> Expected: %d, actual: %d for account %s" % ( expectedInitialBalance , initialBalance , key . name ) ) return False
Validate each account has the expected MES balance.
Validate each account has the expected MES balance .
"""Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal."""
self
initialBalances
transferAmount
source
accounts