def testGetBalance(self): for ballanceType in ['spendable','spend', 'unconf', \ 'unconfirmed', 'total', 'ultimate','unspent', 'full']: self.assertEqual( self.jsonServer.jsonrpc_getbalance(ballanceType), AmountToJSON(self.wallet.getBalance(ballanceType))) self.assertEqual(self.jsonServer.jsonrpc_getbalance('bogus'), -1)
def testGetWalletInfo(self): wltInfo = self.jsonServer.jsonrpc_getwalletinfo() self.assertEqual(wltInfo['name'], TEST_WALLET_NAME) self.assertEqual(wltInfo['description'], TEST_WALLET_DESCRIPTION) self.assertEqual(wltInfo['balance'], AmountToJSON(self.wallet.getBalance('Spend'))) self.assertEqual(wltInfo['keypoolsize'], self.wallet.addrPoolSize) self.assertEqual(wltInfo['numaddrgen'], len(self.wallet.addrMap)) self.assertEqual(wltInfo['highestusedindex'], self.wallet.highestUsedChainIndex)
def testGetBalance(self): balances = {'spendable' : FIRST_WLT_BALANCE, \ 'spend' : FIRST_WLT_BALANCE, \ 'unconf' : 0, \ 'unconfirmed' : 0, \ 'total' : FIRST_WLT_BALANCE, \ 'ultimate' : FIRST_WLT_BALANCE, \ 'unspent' : FIRST_WLT_BALANCE, \ 'full' : FIRST_WLT_BALANCE} for balanceType in balances.keys(): result = self.jsonServer.jsonrpc_getbalance(balanceType) self.assertEqual(result, AmountToJSON(self.wltA.getBalance(balanceType)))