Best Python code snippet using yandex-tank
importmulti.py
Source:importmulti.py
...16 self.log.info("Mining blocks...")17 self.nodes[0].generate(1)18 self.nodes[1].generate(1)19 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']20 node0_address1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())21 #Check only one address22 assert_equal(node0_address1['ismine'], True)23 #Node 1 sync test24 assert_equal(self.nodes[1].getblockcount(),1)25 #Address Test - before import26 address_info = self.nodes[1].validateaddress(node0_address1['address'])27 assert_equal(address_info['iswatchonly'], False)28 assert_equal(address_info['ismine'], False)29 # RPC importmulti -----------------------------------------------30 # Californiacoin Address31 self.log.info("Should import an address")32 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())33 result = self.nodes[1].importmulti([{34 "scriptPubKey": {35 "address": address['address']36 },37 "timestamp": "now",38 }])39 assert_equal(result[0]['success'], True)40 address_assert = self.nodes[1].validateaddress(address['address'])41 assert_equal(address_assert['iswatchonly'], True)42 assert_equal(address_assert['ismine'], False)43 assert_equal(address_assert['timestamp'], timestamp)44 watchonly_address = address['address']45 watchonly_timestamp = timestamp46 self.log.info("Should not import an invalid address")47 result = self.nodes[1].importmulti([{48 "scriptPubKey": {49 "address": "not valid address",50 },51 "timestamp": "now",52 }])53 assert_equal(result[0]['success'], False)54 assert_equal(result[0]['error']['code'], -5)55 assert_equal(result[0]['error']['message'], 'Invalid address')56 # ScriptPubKey + internal57 self.log.info("Should import a scriptPubKey with internal flag")58 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())59 result = self.nodes[1].importmulti([{60 "scriptPubKey": address['scriptPubKey'],61 "timestamp": "now",62 "internal": True63 }])64 assert_equal(result[0]['success'], True)65 address_assert = self.nodes[1].validateaddress(address['address'])66 assert_equal(address_assert['iswatchonly'], True)67 assert_equal(address_assert['ismine'], False)68 assert_equal(address_assert['timestamp'], timestamp)69 # ScriptPubKey + !internal70 self.log.info("Should not import a scriptPubKey without internal flag")71 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())72 result = self.nodes[1].importmulti([{73 "scriptPubKey": address['scriptPubKey'],74 "timestamp": "now",75 }])76 assert_equal(result[0]['success'], False)77 assert_equal(result[0]['error']['code'], -8)78 assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')79 address_assert = self.nodes[1].validateaddress(address['address'])80 assert_equal(address_assert['iswatchonly'], False)81 assert_equal(address_assert['ismine'], False)82 assert_equal('timestamp' in address_assert, False)83 # Address + Public key + !Internal84 self.log.info("Should import an address with public key")85 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())86 result = self.nodes[1].importmulti([{87 "scriptPubKey": {88 "address": address['address']89 },90 "timestamp": "now",91 "pubkeys": [ address['pubkey'] ]92 }])93 assert_equal(result[0]['success'], True)94 address_assert = self.nodes[1].validateaddress(address['address'])95 assert_equal(address_assert['iswatchonly'], True)96 assert_equal(address_assert['ismine'], False)97 assert_equal(address_assert['timestamp'], timestamp)98 # ScriptPubKey + Public key + internal99 self.log.info("Should import a scriptPubKey with internal and with public key")100 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())101 request = [{102 "scriptPubKey": address['scriptPubKey'],103 "timestamp": "now",104 "pubkeys": [ address['pubkey'] ],105 "internal": True106 }]107 result = self.nodes[1].importmulti(request)108 assert_equal(result[0]['success'], True)109 address_assert = self.nodes[1].validateaddress(address['address'])110 assert_equal(address_assert['iswatchonly'], True)111 assert_equal(address_assert['ismine'], False)112 assert_equal(address_assert['timestamp'], timestamp)113 # ScriptPubKey + Public key + !internal114 self.log.info("Should not import a scriptPubKey without internal and with public key")115 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())116 request = [{117 "scriptPubKey": address['scriptPubKey'],118 "timestamp": "now",119 "pubkeys": [ address['pubkey'] ]120 }]121 result = self.nodes[1].importmulti(request)122 assert_equal(result[0]['success'], False)123 assert_equal(result[0]['error']['code'], -8)124 assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')125 address_assert = self.nodes[1].validateaddress(address['address'])126 assert_equal(address_assert['iswatchonly'], False)127 assert_equal(address_assert['ismine'], False)128 assert_equal('timestamp' in address_assert, False)129 # Address + Private key + !watchonly130 self.log.info("Should import an address with private key")131 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())132 result = self.nodes[1].importmulti([{133 "scriptPubKey": {134 "address": address['address']135 },136 "timestamp": "now",137 "keys": [ self.nodes[0].dumpprivkey(address['address']) ]138 }])139 assert_equal(result[0]['success'], True)140 address_assert = self.nodes[1].validateaddress(address['address'])141 assert_equal(address_assert['iswatchonly'], False)142 assert_equal(address_assert['ismine'], True)143 assert_equal(address_assert['timestamp'], timestamp)144 self.log.info("Should not import an address with private key if is already imported")145 result = self.nodes[1].importmulti([{146 "scriptPubKey": {147 "address": address['address']148 },149 "timestamp": "now",150 "keys": [ self.nodes[0].dumpprivkey(address['address']) ]151 }])152 assert_equal(result[0]['success'], False)153 assert_equal(result[0]['error']['code'], -4)154 assert_equal(result[0]['error']['message'], 'The wallet already contains the private key for this address or script')155 # Address + Private key + watchonly156 self.log.info("Should not import an address with private key and with watchonly")157 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())158 result = self.nodes[1].importmulti([{159 "scriptPubKey": {160 "address": address['address']161 },162 "timestamp": "now",163 "keys": [ self.nodes[0].dumpprivkey(address['address']) ],164 "watchonly": True165 }])166 assert_equal(result[0]['success'], False)167 assert_equal(result[0]['error']['code'], -8)168 assert_equal(result[0]['error']['message'], 'Incompatibility found between watchonly and keys')169 address_assert = self.nodes[1].validateaddress(address['address'])170 assert_equal(address_assert['iswatchonly'], False)171 assert_equal(address_assert['ismine'], False)172 assert_equal('timestamp' in address_assert, False)173 # ScriptPubKey + Private key + internal174 self.log.info("Should import a scriptPubKey with internal and with private key")175 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())176 result = self.nodes[1].importmulti([{177 "scriptPubKey": address['scriptPubKey'],178 "timestamp": "now",179 "keys": [ self.nodes[0].dumpprivkey(address['address']) ],180 "internal": True181 }])182 assert_equal(result[0]['success'], True)183 address_assert = self.nodes[1].validateaddress(address['address'])184 assert_equal(address_assert['iswatchonly'], False)185 assert_equal(address_assert['ismine'], True)186 assert_equal(address_assert['timestamp'], timestamp)187 # ScriptPubKey + Private key + !internal188 self.log.info("Should not import a scriptPubKey without internal and with private key")189 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())190 result = self.nodes[1].importmulti([{191 "scriptPubKey": address['scriptPubKey'],192 "timestamp": "now",193 "keys": [ self.nodes[0].dumpprivkey(address['address']) ]194 }])195 assert_equal(result[0]['success'], False)196 assert_equal(result[0]['error']['code'], -8)197 assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')198 address_assert = self.nodes[1].validateaddress(address['address'])199 assert_equal(address_assert['iswatchonly'], False)200 assert_equal(address_assert['ismine'], False)201 assert_equal('timestamp' in address_assert, False)202 # P2SH address203 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())204 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())205 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())206 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['address'], sig_address_2['address'], sig_address_3['pubkey']])207 self.nodes[1].generate(100)208 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)209 self.nodes[1].generate(1)210 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']211 self.log.info("Should import a p2sh")212 result = self.nodes[1].importmulti([{213 "scriptPubKey": {214 "address": multi_sig_script['address']215 },216 "timestamp": "now",217 }])218 assert_equal(result[0]['success'], True)219 address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])220 assert_equal(address_assert['isscript'], True)221 assert_equal(address_assert['iswatchonly'], True)222 assert_equal(address_assert['timestamp'], timestamp)223 p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]224 assert_equal(p2shunspent['spendable'], False)225 assert_equal(p2shunspent['solvable'], False)226 # P2SH + Redeem script227 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())228 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())229 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())230 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['address'], sig_address_2['address'], sig_address_3['pubkey']])231 self.nodes[1].generate(100)232 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)233 self.nodes[1].generate(1)234 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']235 self.log.info("Should import a p2sh with respective redeem script")236 result = self.nodes[1].importmulti([{237 "scriptPubKey": {238 "address": multi_sig_script['address']239 },240 "timestamp": "now",241 "redeemscript": multi_sig_script['redeemScript']242 }])243 assert_equal(result[0]['success'], True)244 address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])245 assert_equal(address_assert['timestamp'], timestamp)246 p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]247 assert_equal(p2shunspent['spendable'], False)248 assert_equal(p2shunspent['solvable'], True)249 # P2SH + Redeem script + Private Keys + !Watchonly250 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())251 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())252 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())253 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['address'], sig_address_2['address'], sig_address_3['pubkey']])254 self.nodes[1].generate(100)255 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)256 self.nodes[1].generate(1)257 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']258 self.log.info("Should import a p2sh with respective redeem script and private keys")259 result = self.nodes[1].importmulti([{260 "scriptPubKey": {261 "address": multi_sig_script['address']262 },263 "timestamp": "now",264 "redeemscript": multi_sig_script['redeemScript'],265 "keys": [ self.nodes[0].dumpprivkey(sig_address_1['address']), self.nodes[0].dumpprivkey(sig_address_2['address'])]266 }])267 assert_equal(result[0]['success'], True)268 address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])269 assert_equal(address_assert['timestamp'], timestamp)270 p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]271 assert_equal(p2shunspent['spendable'], False)272 assert_equal(p2shunspent['solvable'], True)273 # P2SH + Redeem script + Private Keys + Watchonly274 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())275 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())276 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())277 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['address'], sig_address_2['address'], sig_address_3['pubkey']])278 self.nodes[1].generate(100)279 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)280 self.nodes[1].generate(1)281 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']282 self.log.info("Should import a p2sh with respective redeem script and private keys")283 result = self.nodes[1].importmulti([{284 "scriptPubKey": {285 "address": multi_sig_script['address']286 },287 "timestamp": "now",288 "redeemscript": multi_sig_script['redeemScript'],289 "keys": [ self.nodes[0].dumpprivkey(sig_address_1['address']), self.nodes[0].dumpprivkey(sig_address_2['address'])],290 "watchonly": True291 }])292 assert_equal(result[0]['success'], False)293 assert_equal(result[0]['error']['code'], -8)294 assert_equal(result[0]['error']['message'], 'Incompatibility found between watchonly and keys')295 # Address + Public key + !Internal + Wrong pubkey296 self.log.info("Should not import an address with a wrong public key")297 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())298 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())299 result = self.nodes[1].importmulti([{300 "scriptPubKey": {301 "address": address['address']302 },303 "timestamp": "now",304 "pubkeys": [ address2['pubkey'] ]305 }])306 assert_equal(result[0]['success'], False)307 assert_equal(result[0]['error']['code'], -5)308 assert_equal(result[0]['error']['message'], 'Consistency check failed')309 address_assert = self.nodes[1].validateaddress(address['address'])310 assert_equal(address_assert['iswatchonly'], False)311 assert_equal(address_assert['ismine'], False)312 assert_equal('timestamp' in address_assert, False)313 # ScriptPubKey + Public key + internal + Wrong pubkey314 self.log.info("Should not import a scriptPubKey with internal and with a wrong public key")315 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())316 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())317 request = [{318 "scriptPubKey": address['scriptPubKey'],319 "timestamp": "now",320 "pubkeys": [ address2['pubkey'] ],321 "internal": True322 }]323 result = self.nodes[1].importmulti(request)324 assert_equal(result[0]['success'], False)325 assert_equal(result[0]['error']['code'], -5)326 assert_equal(result[0]['error']['message'], 'Consistency check failed')327 address_assert = self.nodes[1].validateaddress(address['address'])328 assert_equal(address_assert['iswatchonly'], False)329 assert_equal(address_assert['ismine'], False)330 assert_equal('timestamp' in address_assert, False)331 # Address + Private key + !watchonly + Wrong private key332 self.log.info("Should not import an address with a wrong private key")333 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())334 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())335 result = self.nodes[1].importmulti([{336 "scriptPubKey": {337 "address": address['address']338 },339 "timestamp": "now",340 "keys": [ self.nodes[0].dumpprivkey(address2['address']) ]341 }])342 assert_equal(result[0]['success'], False)343 assert_equal(result[0]['error']['code'], -5)344 assert_equal(result[0]['error']['message'], 'Consistency check failed')345 address_assert = self.nodes[1].validateaddress(address['address'])346 assert_equal(address_assert['iswatchonly'], False)347 assert_equal(address_assert['ismine'], False)348 assert_equal('timestamp' in address_assert, False)349 # ScriptPubKey + Private key + internal + Wrong private key350 self.log.info("Should not import a scriptPubKey with internal and with a wrong private key")351 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())352 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())353 result = self.nodes[1].importmulti([{354 "scriptPubKey": address['scriptPubKey'],355 "timestamp": "now",356 "keys": [ self.nodes[0].dumpprivkey(address2['address']) ],357 "internal": True358 }])359 assert_equal(result[0]['success'], False)360 assert_equal(result[0]['error']['code'], -5)361 assert_equal(result[0]['error']['message'], 'Consistency check failed')362 address_assert = self.nodes[1].validateaddress(address['address'])363 assert_equal(address_assert['iswatchonly'], False)364 assert_equal(address_assert['ismine'], False)365 assert_equal('timestamp' in address_assert, False)366 # Importing existing watch only address with new timestamp should replace saved timestamp.367 assert_greater_than(timestamp, watchonly_timestamp)368 self.log.info("Should replace previously saved watch only timestamp.")369 result = self.nodes[1].importmulti([{370 "scriptPubKey": {371 "address": watchonly_address,372 },373 "timestamp": "now",374 }])375 assert_equal(result[0]['success'], True)376 address_assert = self.nodes[1].validateaddress(watchonly_address)377 assert_equal(address_assert['iswatchonly'], True)378 assert_equal(address_assert['ismine'], False)379 assert_equal(address_assert['timestamp'], timestamp)380 watchonly_timestamp = timestamp381 # restart nodes to check for proper serialization/deserialization of watch only address382 self.stop_nodes()383 self.start_nodes()384 address_assert = self.nodes[1].validateaddress(watchonly_address)385 assert_equal(address_assert['iswatchonly'], True)386 assert_equal(address_assert['ismine'], False)387 assert_equal(address_assert['timestamp'], watchonly_timestamp)388 # Bad or missing timestamps389 self.log.info("Should throw on invalid or missing timestamp values")390 assert_raises_rpc_error(-3, 'Missing required timestamp field for key',391 self.nodes[1].importmulti, [{392 "scriptPubKey": address['scriptPubKey'],393 }])394 assert_raises_rpc_error(-3, 'Expected number or "now" timestamp value for key. got type string',395 self.nodes[1].importmulti, [{396 "scriptPubKey": address['scriptPubKey'],397 "timestamp": "",398 }])...
wallet_importmulti.py
Source:wallet_importmulti.py
...16 self.log.info("Mining blocks...")17 self.nodes[0].generate(1)18 self.nodes[1].generate(1)19 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']20 node0_address1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())21 #Check only one address22 assert_equal(node0_address1['ismine'], True)23 #Node 1 sync test24 assert_equal(self.nodes[1].getblockcount(),1)25 #Address Test - before import26 address_info = self.nodes[1].validateaddress(node0_address1['address'])27 assert_equal(address_info['iswatchonly'], False)28 assert_equal(address_info['ismine'], False)29 # RPC importmulti -----------------------------------------------30 # Bitcoin Address31 self.log.info("Should import an address")32 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())33 result = self.nodes[1].importmulti([{34 "scriptPubKey": {35 "address": address['address']36 },37 "timestamp": "now",38 }])39 assert_equal(result[0]['success'], True)40 address_assert = self.nodes[1].validateaddress(address['address'])41 assert_equal(address_assert['iswatchonly'], True)42 assert_equal(address_assert['ismine'], False)43 assert_equal(address_assert['timestamp'], timestamp)44 watchonly_address = address['address']45 watchonly_timestamp = timestamp46 self.log.info("Should not import an invalid address")47 result = self.nodes[1].importmulti([{48 "scriptPubKey": {49 "address": "not valid address",50 },51 "timestamp": "now",52 }])53 assert_equal(result[0]['success'], False)54 assert_equal(result[0]['error']['code'], -5)55 assert_equal(result[0]['error']['message'], 'Invalid address')56 # ScriptPubKey + internal57 self.log.info("Should import a scriptPubKey with internal flag")58 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())59 result = self.nodes[1].importmulti([{60 "scriptPubKey": address['scriptPubKey'],61 "timestamp": "now",62 "internal": True63 }])64 assert_equal(result[0]['success'], True)65 address_assert = self.nodes[1].validateaddress(address['address'])66 assert_equal(address_assert['iswatchonly'], True)67 assert_equal(address_assert['ismine'], False)68 assert_equal(address_assert['timestamp'], timestamp)69 # ScriptPubKey + !internal70 self.log.info("Should not import a scriptPubKey without internal flag")71 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())72 result = self.nodes[1].importmulti([{73 "scriptPubKey": address['scriptPubKey'],74 "timestamp": "now",75 }])76 assert_equal(result[0]['success'], False)77 assert_equal(result[0]['error']['code'], -8)78 assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')79 address_assert = self.nodes[1].validateaddress(address['address'])80 assert_equal(address_assert['iswatchonly'], False)81 assert_equal(address_assert['ismine'], False)82 assert_equal('timestamp' in address_assert, False)83 # Address + Public key + !Internal84 self.log.info("Should import an address with public key")85 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())86 result = self.nodes[1].importmulti([{87 "scriptPubKey": {88 "address": address['address']89 },90 "timestamp": "now",91 "pubkeys": [ address['pubkey'] ]92 }])93 assert_equal(result[0]['success'], True)94 address_assert = self.nodes[1].validateaddress(address['address'])95 assert_equal(address_assert['iswatchonly'], True)96 assert_equal(address_assert['ismine'], False)97 assert_equal(address_assert['timestamp'], timestamp)98 # ScriptPubKey + Public key + internal99 self.log.info("Should import a scriptPubKey with internal and with public key")100 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())101 request = [{102 "scriptPubKey": address['scriptPubKey'],103 "timestamp": "now",104 "pubkeys": [ address['pubkey'] ],105 "internal": True106 }]107 result = self.nodes[1].importmulti(request)108 assert_equal(result[0]['success'], True)109 address_assert = self.nodes[1].validateaddress(address['address'])110 assert_equal(address_assert['iswatchonly'], True)111 assert_equal(address_assert['ismine'], False)112 assert_equal(address_assert['timestamp'], timestamp)113 # ScriptPubKey + Public key + !internal114 self.log.info("Should not import a scriptPubKey without internal and with public key")115 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())116 request = [{117 "scriptPubKey": address['scriptPubKey'],118 "timestamp": "now",119 "pubkeys": [ address['pubkey'] ]120 }]121 result = self.nodes[1].importmulti(request)122 assert_equal(result[0]['success'], False)123 assert_equal(result[0]['error']['code'], -8)124 assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')125 address_assert = self.nodes[1].validateaddress(address['address'])126 assert_equal(address_assert['iswatchonly'], False)127 assert_equal(address_assert['ismine'], False)128 assert_equal('timestamp' in address_assert, False)129 # Address + Private key + !watchonly130 self.log.info("Should import an address with private key")131 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())132 result = self.nodes[1].importmulti([{133 "scriptPubKey": {134 "address": address['address']135 },136 "timestamp": "now",137 "keys": [ self.nodes[0].dumpprivkey(address['address']) ]138 }])139 assert_equal(result[0]['success'], True)140 address_assert = self.nodes[1].validateaddress(address['address'])141 assert_equal(address_assert['iswatchonly'], False)142 assert_equal(address_assert['ismine'], True)143 assert_equal(address_assert['timestamp'], timestamp)144 self.log.info("Should not import an address with private key if is already imported")145 result = self.nodes[1].importmulti([{146 "scriptPubKey": {147 "address": address['address']148 },149 "timestamp": "now",150 "keys": [ self.nodes[0].dumpprivkey(address['address']) ]151 }])152 assert_equal(result[0]['success'], False)153 assert_equal(result[0]['error']['code'], -4)154 assert_equal(result[0]['error']['message'], 'The wallet already contains the private key for this address or script')155 # Address + Private key + watchonly156 self.log.info("Should not import an address with private key and with watchonly")157 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())158 result = self.nodes[1].importmulti([{159 "scriptPubKey": {160 "address": address['address']161 },162 "timestamp": "now",163 "keys": [ self.nodes[0].dumpprivkey(address['address']) ],164 "watchonly": True165 }])166 assert_equal(result[0]['success'], False)167 assert_equal(result[0]['error']['code'], -8)168 assert_equal(result[0]['error']['message'], 'Incompatibility found between watchonly and keys')169 address_assert = self.nodes[1].validateaddress(address['address'])170 assert_equal(address_assert['iswatchonly'], False)171 assert_equal(address_assert['ismine'], False)172 assert_equal('timestamp' in address_assert, False)173 # ScriptPubKey + Private key + internal174 self.log.info("Should import a scriptPubKey with internal and with private key")175 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())176 result = self.nodes[1].importmulti([{177 "scriptPubKey": address['scriptPubKey'],178 "timestamp": "now",179 "keys": [ self.nodes[0].dumpprivkey(address['address']) ],180 "internal": True181 }])182 assert_equal(result[0]['success'], True)183 address_assert = self.nodes[1].validateaddress(address['address'])184 assert_equal(address_assert['iswatchonly'], False)185 assert_equal(address_assert['ismine'], True)186 assert_equal(address_assert['timestamp'], timestamp)187 # ScriptPubKey + Private key + !internal188 self.log.info("Should not import a scriptPubKey without internal and with private key")189 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())190 result = self.nodes[1].importmulti([{191 "scriptPubKey": address['scriptPubKey'],192 "timestamp": "now",193 "keys": [ self.nodes[0].dumpprivkey(address['address']) ]194 }])195 assert_equal(result[0]['success'], False)196 assert_equal(result[0]['error']['code'], -8)197 assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')198 address_assert = self.nodes[1].validateaddress(address['address'])199 assert_equal(address_assert['iswatchonly'], False)200 assert_equal(address_assert['ismine'], False)201 assert_equal('timestamp' in address_assert, False)202 # P2SH address203 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())204 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())205 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())206 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])207 self.nodes[1].generate(100)208 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)209 self.nodes[1].generate(1)210 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']211 self.log.info("Should import a p2sh")212 result = self.nodes[1].importmulti([{213 "scriptPubKey": {214 "address": multi_sig_script['address']215 },216 "timestamp": "now",217 }])218 assert_equal(result[0]['success'], True)219 address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])220 assert_equal(address_assert['isscript'], True)221 assert_equal(address_assert['iswatchonly'], True)222 assert_equal(address_assert['timestamp'], timestamp)223 p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]224 assert_equal(p2shunspent['spendable'], False)225 assert_equal(p2shunspent['solvable'], False)226 # P2SH + Redeem script227 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())228 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())229 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())230 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])231 self.nodes[1].generate(100)232 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)233 self.nodes[1].generate(1)234 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']235 self.log.info("Should import a p2sh with respective redeem script")236 result = self.nodes[1].importmulti([{237 "scriptPubKey": {238 "address": multi_sig_script['address']239 },240 "timestamp": "now",241 "redeemscript": multi_sig_script['redeemScript']242 }])243 assert_equal(result[0]['success'], True)244 address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])245 assert_equal(address_assert['timestamp'], timestamp)246 p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]247 assert_equal(p2shunspent['spendable'], False)248 assert_equal(p2shunspent['solvable'], True)249 # P2SH + Redeem script + Private Keys + !Watchonly250 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())251 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())252 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())253 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])254 self.nodes[1].generate(100)255 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)256 self.nodes[1].generate(1)257 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']258 self.log.info("Should import a p2sh with respective redeem script and private keys")259 result = self.nodes[1].importmulti([{260 "scriptPubKey": {261 "address": multi_sig_script['address']262 },263 "timestamp": "now",264 "redeemscript": multi_sig_script['redeemScript'],265 "keys": [ self.nodes[0].dumpprivkey(sig_address_1['address']), self.nodes[0].dumpprivkey(sig_address_2['address'])]266 }])267 assert_equal(result[0]['success'], True)268 address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])269 assert_equal(address_assert['timestamp'], timestamp)270 p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]271 assert_equal(p2shunspent['spendable'], False)272 assert_equal(p2shunspent['solvable'], True)273 # P2SH + Redeem script + Private Keys + Watchonly274 sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())275 sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())276 sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())277 multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])278 self.nodes[1].generate(100)279 transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)280 self.nodes[1].generate(1)281 timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']282 self.log.info("Should import a p2sh with respective redeem script and private keys")283 result = self.nodes[1].importmulti([{284 "scriptPubKey": {285 "address": multi_sig_script['address']286 },287 "timestamp": "now",288 "redeemscript": multi_sig_script['redeemScript'],289 "keys": [ self.nodes[0].dumpprivkey(sig_address_1['address']), self.nodes[0].dumpprivkey(sig_address_2['address'])],290 "watchonly": True291 }])292 assert_equal(result[0]['success'], False)293 assert_equal(result[0]['error']['code'], -8)294 assert_equal(result[0]['error']['message'], 'Incompatibility found between watchonly and keys')295 # Address + Public key + !Internal + Wrong pubkey296 self.log.info("Should not import an address with a wrong public key")297 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())298 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())299 result = self.nodes[1].importmulti([{300 "scriptPubKey": {301 "address": address['address']302 },303 "timestamp": "now",304 "pubkeys": [ address2['pubkey'] ]305 }])306 assert_equal(result[0]['success'], False)307 assert_equal(result[0]['error']['code'], -5)308 assert_equal(result[0]['error']['message'], 'Consistency check failed')309 address_assert = self.nodes[1].validateaddress(address['address'])310 assert_equal(address_assert['iswatchonly'], False)311 assert_equal(address_assert['ismine'], False)312 assert_equal('timestamp' in address_assert, False)313 # ScriptPubKey + Public key + internal + Wrong pubkey314 self.log.info("Should not import a scriptPubKey with internal and with a wrong public key")315 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())316 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())317 request = [{318 "scriptPubKey": address['scriptPubKey'],319 "timestamp": "now",320 "pubkeys": [ address2['pubkey'] ],321 "internal": True322 }]323 result = self.nodes[1].importmulti(request)324 assert_equal(result[0]['success'], False)325 assert_equal(result[0]['error']['code'], -5)326 assert_equal(result[0]['error']['message'], 'Consistency check failed')327 address_assert = self.nodes[1].validateaddress(address['address'])328 assert_equal(address_assert['iswatchonly'], False)329 assert_equal(address_assert['ismine'], False)330 assert_equal('timestamp' in address_assert, False)331 # Address + Private key + !watchonly + Wrong private key332 self.log.info("Should not import an address with a wrong private key")333 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())334 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())335 result = self.nodes[1].importmulti([{336 "scriptPubKey": {337 "address": address['address']338 },339 "timestamp": "now",340 "keys": [ self.nodes[0].dumpprivkey(address2['address']) ]341 }])342 assert_equal(result[0]['success'], False)343 assert_equal(result[0]['error']['code'], -5)344 assert_equal(result[0]['error']['message'], 'Consistency check failed')345 address_assert = self.nodes[1].validateaddress(address['address'])346 assert_equal(address_assert['iswatchonly'], False)347 assert_equal(address_assert['ismine'], False)348 assert_equal('timestamp' in address_assert, False)349 # ScriptPubKey + Private key + internal + Wrong private key350 self.log.info("Should not import a scriptPubKey with internal and with a wrong private key")351 address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())352 address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())353 result = self.nodes[1].importmulti([{354 "scriptPubKey": address['scriptPubKey'],355 "timestamp": "now",356 "keys": [ self.nodes[0].dumpprivkey(address2['address']) ],357 "internal": True358 }])359 assert_equal(result[0]['success'], False)360 assert_equal(result[0]['error']['code'], -5)361 assert_equal(result[0]['error']['message'], 'Consistency check failed')362 address_assert = self.nodes[1].validateaddress(address['address'])363 assert_equal(address_assert['iswatchonly'], False)364 assert_equal(address_assert['ismine'], False)365 assert_equal('timestamp' in address_assert, False)366 # Importing existing watch only address with new timestamp should replace saved timestamp.367 assert_greater_than(timestamp, watchonly_timestamp)368 self.log.info("Should replace previously saved watch only timestamp.")369 result = self.nodes[1].importmulti([{370 "scriptPubKey": {371 "address": watchonly_address,372 },373 "timestamp": "now",374 }])375 assert_equal(result[0]['success'], True)376 address_assert = self.nodes[1].validateaddress(watchonly_address)377 assert_equal(address_assert['iswatchonly'], True)378 assert_equal(address_assert['ismine'], False)379 assert_equal(address_assert['timestamp'], timestamp)380 watchonly_timestamp = timestamp381 # restart nodes to check for proper serialization/deserialization of watch only address382 self.stop_nodes()383 self.start_nodes()384 address_assert = self.nodes[1].validateaddress(watchonly_address)385 assert_equal(address_assert['iswatchonly'], True)386 assert_equal(address_assert['ismine'], False)387 assert_equal(address_assert['timestamp'], watchonly_timestamp)388 # Bad or missing timestamps389 self.log.info("Should throw on invalid or missing timestamp values")390 assert_raises_rpc_error(-3, 'Missing required timestamp field for key',391 self.nodes[1].importmulti, [{392 "scriptPubKey": address['scriptPubKey'],393 }])394 assert_raises_rpc_error(-3, 'Expected number or "now" timestamp value for key. got type string',395 self.nodes[1].importmulti, [{396 "scriptPubKey": address['scriptPubKey'],397 "timestamp": "",398 }])...
checkout-data-resolver.js
Source:checkout-data-resolver.js
1/**2 * Copyright © 2015 Magento. All rights reserved.3 * See COPYING.txt for license details.4 */5/*jshint browser:true*/6/*global alert*/7/**8 * Checkout adapter for customer data storage9 */10define(11 [12 'Magento_Customer/js/model/address-list',13 'Magento_Checkout/js/model/quote',14 'Magento_Checkout/js/checkout-data',15 'Magento_Checkout/js/action/create-shipping-address',16 'Magento_Checkout/js/action/select-shipping-address',17 'Magento_Checkout/js/action/select-shipping-method',18 'Magento_Checkout/js/model/payment-service',19 'Magento_Checkout/js/action/select-payment-method',20 'Magento_Checkout/js/model/address-converter',21 'Magento_Checkout/js/action/select-billing-address',22 'Magento_Checkout/js/action/create-billing-address',23 'underscore'24 ],25 function (26 addressList,27 quote,28 checkoutData,29 createShippingAddress,30 selectShippingAddress,31 selectShippingMethodAction,32 paymentService,33 selectPaymentMethodAction,34 addressConverter,35 selectBillingAddress,36 createBillingAddress,37 _38 ) {39 'use strict';40 return {41 /**42 * Resolve estimation address. Used local storage43 */44 resolveEstimationAddress: function () {45 var address;46 if (checkoutData.getShippingAddressFromData()) {47 address = addressConverter.formAddressDataToQuoteAddress(checkoutData.getShippingAddressFromData());48 selectShippingAddress(address);49 } else {50 this.resolveShippingAddress();51 }52 if (quote.isVirtual()) {53 if (checkoutData.getBillingAddressFromData()) {54 address = addressConverter.formAddressDataToQuoteAddress(55 checkoutData.getBillingAddressFromData()56 );57 selectBillingAddress(address);58 } else {59 this.resolveBillingAddress();60 }61 }62 },63 /**64 * Resolve shipping address. Used local storage65 */66 resolveShippingAddress: function () {67 var newCustomerShippingAddress = checkoutData.getNewCustomerShippingAddress();68 if (newCustomerShippingAddress) {69 createShippingAddress(newCustomerShippingAddress);70 }71 this.applyShippingAddress();72 },73 /**74 * Apply resolved estimated address to quote75 *76 * @param {Object} isEstimatedAddress77 */78 applyShippingAddress: function (isEstimatedAddress) {79 var address,80 shippingAddress,81 isConvertAddress,82 addressData,83 isShippingAddressInitialized;84 if (addressList().length == 0) {85 address = addressConverter.formAddressDataToQuoteAddress(86 checkoutData.getShippingAddressFromData()87 );88 selectShippingAddress(address);89 }90 shippingAddress = quote.shippingAddress();91 isConvertAddress = isEstimatedAddress || false;92 if (!shippingAddress) {93 isShippingAddressInitialized = addressList.some(function (addressFromList) {94 if (checkoutData.getSelectedShippingAddress() == addressFromList.getKey()) {95 addressData = isConvertAddress ?96 addressConverter.addressToEstimationAddress(addressFromList)97 : addressFromList;98 selectShippingAddress(addressData);99 return true;100 }101 return false;102 });103 if (!isShippingAddressInitialized) {104 isShippingAddressInitialized = addressList.some(function (address) {105 if (address.isDefaultShipping()) {106 addressData = isConvertAddress ?107 addressConverter.addressToEstimationAddress(address)108 : address;109 selectShippingAddress(addressData);110 return true;111 }112 return false;113 });114 }115 if (!isShippingAddressInitialized && addressList().length == 1) {116 addressData = isConvertAddress ?117 addressConverter.addressToEstimationAddress(addressList()[0])118 : addressList()[0];119 selectShippingAddress(addressData);120 }121 }122 },123 /**124 * @param {Object} ratesData125 */126 resolveShippingRates: function (ratesData) {127 var selectedShippingRate = checkoutData.getSelectedShippingRate(),128 availableRate = false;129 if (ratesData.length == 1) {130 //set shipping rate if we have only one available shipping rate131 selectShippingMethodAction(ratesData[0]);132 return;133 }134 if (quote.shippingMethod()) {135 availableRate = _.find(ratesData, function (rate) {136 return rate.carrier_code == quote.shippingMethod().carrier_code &&137 rate.method_code == quote.shippingMethod().method_code;138 });139 }140 if (!availableRate && selectedShippingRate) {141 availableRate = _.find(ratesData, function (rate) {142 return rate.carrier_code + '_' + rate.method_code === selectedShippingRate;143 });144 }145 if (!availableRate && window.checkoutConfig.selectedShippingMethod) {146 availableRate = true;147 selectShippingMethodAction(window.checkoutConfig.selectedShippingMethod);148 }149 //Unset selected shipping method if not available150 if (!availableRate) {151 selectShippingMethodAction(null);152 } else {153 selectShippingMethodAction(availableRate);154 }155 },156 /**157 * Resolve payment method. Used local storage158 */159 resolvePaymentMethod: function () {160 var availablePaymentMethods = paymentService.getAvailablePaymentMethods(),161 selectedPaymentMethod = checkoutData.getSelectedPaymentMethod();162 if (selectedPaymentMethod) {163 availablePaymentMethods.some(function (payment) {164 if (payment.method == selectedPaymentMethod) {165 selectPaymentMethodAction(payment);166 }167 });168 }169 },170 /**171 * Resolve billing address. Used local storage172 */173 resolveBillingAddress: function () {174 var selectedBillingAddress = checkoutData.getSelectedBillingAddress(),175 newCustomerBillingAddressData = checkoutData.getNewCustomerBillingAddress();176 if (selectedBillingAddress) {177 if (selectedBillingAddress == 'new-customer-address' && newCustomerBillingAddressData) {178 selectBillingAddress(createBillingAddress(newCustomerBillingAddressData));179 } else {180 addressList.some(function (address) {181 if (selectedBillingAddress == address.getKey()) {182 selectBillingAddress(address);183 }184 });185 }186 } else {187 this.applyBillingAddress();188 }189 },190 /**191 * Apply resolved billing address to quote192 */193 applyBillingAddress: function () {194 var shippingAddress;195 if (quote.billingAddress()) {196 selectBillingAddress(quote.billingAddress());197 return;198 }199 shippingAddress = quote.shippingAddress();200 if (shippingAddress &&201 shippingAddress.canUseForBilling() &&202 (shippingAddress.isDefaultShipping() || !quote.isVirtual())203 ) {204 //set billing address same as shipping by default if it is not empty205 selectBillingAddress(quote.shippingAddress());206 }207 }208 };209 }...
wallet_accounts.py
Source:wallet_accounts.py
...67 # Create accounts and make sure subsequent account API calls68 # recognize the account/address associations.69 accounts = [Account(name) for name in ("a", "b", "c", "d", "e")]70 for account in accounts:71 account.add_receive_address(node.getaccountaddress(account.name))72 account.verify(node)73 # Send a transaction to each account, and make sure this forces74 # getaccountaddress to generate a new receiving address.75 for account in accounts:76 node.sendtoaddress(account.receive_address, amount_to_send)77 account.add_receive_address(node.getaccountaddress(account.name))78 account.verify(node)79 # Check the amounts received.80 node.generate(1)81 for account in accounts:82 assert_equal(83 node.getreceivedbyaddress(account.addresses[0]), amount_to_send)84 assert_equal(node.getreceivedbyaccount(account.name), amount_to_send)85 86 # Check that sendfrom account reduces listaccounts balances.87 for i, account in enumerate(accounts):88 to_account = accounts[(i+1) % len(accounts)]89 node.sendfrom(account.name, to_account.receive_address, amount_to_send)90 node.generate(1)91 for account in accounts:92 account.add_receive_address(node.getaccountaddress(account.name))93 account.verify(node)94 assert_equal(node.getreceivedbyaccount(account.name), 2)95 node.move(account.name, "", node.getbalance(account.name))96 account.verify(node)97 node.generate(101)98 expected_account_balances = {"": 5200}99 for account in accounts:100 expected_account_balances[account.name] = 0101 assert_equal(node.listaccounts(), expected_account_balances)102 assert_equal(node.getbalance(""), 5200)103 104 # Check that setaccount can assign an account to a new unused address.105 for account in accounts:106 address = node.getaccountaddress("")107 node.setaccount(address, account.name)108 account.add_address(address)109 account.verify(node)110 assert(address not in node.getaddressesbyaccount(""))111 112 # Check that addmultisigaddress can assign accounts.113 for account in accounts:114 addresses = []115 for x in range(10):116 addresses.append(node.getnewaddress())117 multisig_address = node.addmultisigaddress(5, addresses, account.name)['address']118 account.add_address(multisig_address)119 account.verify(node)120 node.sendfrom("", multisig_address, 50)121 node.generate(101)122 for account in accounts:123 assert_equal(node.getbalance(account.name), 50)124 # Check that setaccount can change the account of an address from a125 # different account.126 change_account(node, accounts[0].addresses[0], accounts[0], accounts[1])127 # Check that setaccount can change the account of an address which128 # is the receiving address of a different account.129 change_account(node, accounts[0].receive_address, accounts[0], accounts[1])130 # Check that setaccount can set the account of an address already131 # in the account. This is a no-op.132 change_account(node, accounts[2].addresses[0], accounts[2], accounts[2])133 # Check that setaccount can set the account of an address which is134 # already the receiving address of the account. It would probably make135 # sense for this to be a no-op, but right now it resets the receiving136 # address, causing getaccountaddress to return a brand new address.137 change_account(node, accounts[2].receive_address, accounts[2], accounts[2])138class Account:139 def __init__(self, name):140 # Account name141 self.name = name142 # Current receiving address associated with this account.143 self.receive_address = None144 # List of all addresses assigned with this account145 self.addresses = []146 def add_address(self, address):147 assert_equal(address not in self.addresses, True)148 self.addresses.append(address)149 def add_receive_address(self, address):150 self.add_address(address)151 self.receive_address = address152 def verify(self, node):153 if self.receive_address is not None:154 assert self.receive_address in self.addresses155 assert_equal(node.getaccountaddress(self.name), self.receive_address)156 for address in self.addresses:157 assert_equal(node.getaccount(address), self.name)158 assert_equal(159 set(node.getaddressesbyaccount(self.name)), set(self.addresses))160def change_account(node, address, old_account, new_account):161 assert_equal(address in old_account.addresses, True)162 node.setaccount(address, new_account.name)163 old_account.addresses.remove(address)164 new_account.add_address(address)165 # Calling setaccount on an address which was previously the receiving166 # address of a different account should reset the receiving address of167 # the old account, causing getaccountaddress to return a brand new168 # address.169 if address == old_account.receive_address:170 new_address = node.getaccountaddress(old_account.name)171 assert_equal(new_address not in old_account.addresses, True)172 assert_equal(new_address not in new_account.addresses, True)173 old_account.add_receive_address(new_address)174 old_account.verify(node)175 new_account.verify(node)176if __name__ == '__main__':...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!