Browse Source

ts_xmr_autosign: improve balance checking

The MMGen Project 1 year ago
parent
commit
403d3be586
3 changed files with 16 additions and 5 deletions
  1. 1 2
      test/test-release.d/cfg.sh
  2. 12 2
      test/test_py_d/ts_xmr_autosign.py
  3. 3 1
      test/test_py_d/ts_xmrwallet.py

+ 1 - 2
test/test-release.d/cfg.sh

@@ -127,8 +127,7 @@ init_tests() {
 
 	d_xmr="Monero xmrwallet operations"
 	t_xmr="
-		- $test_py --coin=xmr --exclude=xmr_autosign
-		- $test_py --coin=xmr xmr_autosign
+		- $test_py --coin=xmr
 	"
 
 	d_eth="operations for Ethereum and Ethereum Classic using devnet"

+ 12 - 2
test/test_py_d/ts_xmr_autosign.py

@@ -63,7 +63,8 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
 		('gen_kafiles',              'generating key-address files for Miner'),
 		('create_wallets_miner',     'creating Monero wallets for Miner'),
 		('mine_initial_coins',       'mining initial coins'),
-		('fund_alice',               'sending funds to Alice'),
+		('fund_alice1',              'sending funds to Alice (wallet #1)'),
+		('fund_alice2',              'sending funds to Alice (wallet #2)'),
 		('autosign_start_thread',    'starting autosign wait loop'),
 		('create_transfer_tx1',      'creating a transfer TX'),
 		('submit_transfer_tx1',      'submitting the transfer TX'),
@@ -199,6 +200,12 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
 	def delete_dump_files(self):
 		return self._delete_files( '.dump' )
 
+	def fund_alice1(self):
+		return self.fund_alice(wallet=1,check_bal=False)
+
+	def fund_alice2(self):
+		return self.fund_alice(wallet=2)
+
 	def insert_device(self):
 		self.asi.dev_disk_path.touch()
 
@@ -295,7 +302,10 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
 		return self._sync_chkbal( '1', lambda n,b,ub: b == ub and 0.8 < b < 0.86 )
 		# 1.234567891234 - 0.124 - 0.257 = 0.853567891234 (minus fees)
 
-	sync_chkbal3 = sync_chkbal2
+	def sync_chkbal3(self):
+		return self._sync_chkbal(
+			'1-2',
+			lambda n,b,ub: b == ub and ((n == 1 and 0.8 < b < 0.86) or (n == 2 and b > 1.23)) )
 
 	def _mine_chk(self,desc):
 		bal_type = {'locked':'b','unlocked':'ub'}[desc]

+ 3 - 1
test/test_py_d/ts_xmrwallet.py

@@ -416,13 +416,15 @@ class TestSuiteXMRWallet(TestSuiteBase):
 		ok()
 		return await self.mine_chk('miner',1,0,lambda x: x.ub > 20,'unlocked balance > 20')
 
-	async def fund_alice(self,wallet=1):
+	async def fund_alice(self,wallet=1,check_bal=True):
 		self.spawn('', msg_only=True, extra_desc='(transferring funds from Miner wallet)')
 		await self.transfer(
 			'miner',
 			1234567891234,
 			read_from_file(self.users['alice'].addrfile_fs.format(wallet)),
 		)
+		if not check_bal:
+			return 'ok'
 		ok()
 		bal = '1.234567891234'
 		return await self.mine_chk(