Browse Source

cmdtest.py ethbump, swap: minor cleanups

The MMGen Project 7 months ago
parent
commit
a11eb44d85
2 changed files with 13 additions and 8 deletions
  1. 10 7
      test/cmdtest_d/ethbump.py
  2. 3 1
      test/cmdtest_d/swap.py

+ 10 - 7
test/cmdtest_d/ethbump.py

@@ -68,6 +68,13 @@ class CmdTestEthBumpMethods:
 			fee_desc = 'or gas price',
 			bad_fee = '0.9G')
 
+	def _token_fund_user(self, *, mm_idxs):
+		return self._token_transfer_ops(
+			op          = 'fund_user',
+			mm_idxs     = mm_idxs,
+			token_addr  = 'token_addr1',
+			amt         = self.token_fund_amt)
+
 	def _token_txcreate(self, *, args, cmd='txcreate'):
 		self.get_file_with_ext('sigtx', delete_all=True)
 		t = self._create_token_tx(cmd=cmd, fee='1.3G', args=args, add_opts=self.eth_opts)
@@ -204,7 +211,7 @@ class CmdTestEthBump(CmdTestEthBumpMethods, CmdTestEthSwapMethods, CmdTestSwapMe
 			('token_deploy_a',   'deploying ERC20 token MM1 (SafeMath)'),
 			('token_deploy_b',   'deploying ERC20 token MM1 (Owned)'),
 			('token_deploy_c',   'deploying ERC20 token MM1 (Token)'),
-			('token_fund_user',  'transferring token funds from dev to user'),
+			('token_fund_user1', 'transferring token funds from dev to user (addr #1)'),
 			('token_addrgen',    'generating token addresses'),
 			('token_addrimport', 'importing token addresses using token address (MM1)'),
 			('token_bal1',       'the token balance'),
@@ -300,12 +307,8 @@ class CmdTestEthBump(CmdTestEthBumpMethods, CmdTestEthSwapMethods, CmdTestSwapMe
 	def bal4(self):
 		return self._bal_check(pat=rf'{dfl_sid}:E:12\s+4444\.3333\s')
 
-	def token_fund_user(self):
-		return self._token_transfer_ops(
-			op          = 'fund_user',
-			mm_idxs     = [1],
-			token_addr  = 'token_addr1',
-			amt         = self.token_fund_amt)
+	def token_fund_user1(self):
+		return self._token_fund_user(mm_idxs=[1])
 
 	def token_txdo1(self):
 		return self._token_txcreate(cmd='txdo', args=[f'{dfl_sid}:E:2,1.23456', dfl_words_file])

+ 3 - 1
test/cmdtest_d/swap.py

@@ -126,6 +126,7 @@ class CmdTestSwapMethods:
 			file_desc       = 'Unsigned transaction',
 			reload_quote    = False,
 			sign_and_send   = False,
+			need_passphrase = True,
 			expect         = None):
 		t.expect(self.menu_prompt, 'q')
 		t.expect(self.input_sels_prompt, f'{inputs}\n')
@@ -140,7 +141,8 @@ class CmdTestSwapMethods:
 			t.expect(expect)
 		t.expect('to continue: ', '\n')
 		if sign_and_send:
-			t.passphrase(dfl_wcls.desc, rt_pw)
+			if need_passphrase:
+				t.passphrase(dfl_wcls.desc, rt_pw)
 			t.expect('to confirm: ', 'YES\n')
 		else:
 			t.expect('(y/N): ', 'y')            # save?