def scenario( wallets, **kw ): global preorder_info, register_info, update_info, balance_before, balance_after, names_owned_before, names_owned_after, whois, blockchain_record, deposit_info, price_info global blockchain_history, zonefile_info, all_names_info, namespace_names_info, wallet_info, lookup_info, update_history, zonefile_history, names_info testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstack_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) wallet = testlib.blockstack_client_initialize_wallet( "0123456789abcdef", wallets[2].privkey, wallets[3].privkey, wallets[4].privkey ) balance_before = testlib.blockstack_cli_balance() deposit_info = testlib.blockstack_cli_deposit() price_info = testlib.blockstack_cli_price( "foo.test", password="******" ) wallet_info = testlib.blockstack_cli_wallet( "0123456789abcdef" ) resp = testlib.blockstack_cli_register( "foo.test", "0123456789abcdef" ) if 'error' in resp: print >> sys.stderr, json.dumps(resp, indent=4, sort_keys=True) return False # wait for the preorder to get confirmed for i in xrange(0, 5): testlib.next_block( **kw ) # queued? preorder_info = testlib.blockstack_cli_info() names_owned_before = testlib.blockstack_cli_get_names_owned_by_address( wallets[3].addr ) for i in xrange(0, 7): testlib.next_block( **kw ) # wait for the poller to pick it up print >> sys.stderr, "Waiting 10 seconds for the backend to submit the register" time.sleep(10) # wait for the register to get confirmed for i in xrange(0, 5): testlib.next_block( **kw ) # registered? register_info = testlib.blockstack_cli_info() names_info = testlib.blockstack_cli_names() for i in xrange(0, 7): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration" time.sleep(10) # wait for update to get confirmed for i in xrange(0, 5): testlib.next_block( **kw ) update_info = testlib.blockstack_cli_info() names_owned_after = testlib.blockstack_cli_get_names_owned_by_address( wallets[3].addr ) whois = testlib.blockstack_cli_whois( "foo.test" ) for i in xrange(0, 7): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # put some immutable data put_immutable_info = testlib.blockstack_cli_put_immutable( "foo.test", "hello_world", '{"hello": "world"}' ) if 'error' in put_immutable_info: print "put_immutable failed" print json.dumps(put_immutable_info, indent=4, sort_keys=True) return False # wait for update to be confirmed for i in xrange(0, 12): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for backend to acknowledge put-immutable update" time.sleep(10) balance_after = testlib.blockstack_cli_balance() blockchain_history = testlib.blockstack_cli_get_name_blockchain_history( "foo.test" ) zonefile_info = testlib.blockstack_cli_get_name_zonefile( "foo.test", json=False ) all_names_info = testlib.blockstack_cli_get_all_names(0) namespace_names_info = testlib.blockstack_cli_get_names_in_namespace("test", 0) lookup_info = testlib.blockstack_cli_lookup( "foo.test" ) update_history = testlib.blockstack_cli_list_update_history( "foo.test" ) zonefile_history = testlib.blockstack_cli_list_zonefile_history( "foo.test" ) blockchain_record = testlib.blockstack_cli_get_name_blockchain_record( "foo.test" )
def scenario(wallets, **kw): global preorder_info, register_info, update_info, balance_before, balance_after, names_owned_before, names_owned_after, whois, blockchain_record, deposit_info, price_info global blockchain_history, zonefile_info, all_names_info, namespace_names_info, wallet_info, lookup_info, update_history, zonefile_history, names_info testlib.blockstack_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 10, 10, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstack_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) wallet = testlib.blockstack_client_initialize_wallet( "0123456789abcdef", wallets[2].privkey, wallets[3].privkey, wallets[4].privkey) balance_before = testlib.blockstack_cli_balance() deposit_info = testlib.blockstack_cli_deposit() price_info = testlib.blockstack_cli_price("foo.test", password="******") wallet_info = testlib.blockstack_cli_wallet("0123456789abcdef") resp = testlib.blockstack_cli_register("foo.test", "0123456789abcdef") if 'error' in resp: print >> sys.stderr, json.dumps(resp, indent=4, sort_keys=True) return False # wait for the preorder to get confirmed for i in xrange(0, 5): testlib.next_block(**kw) # queued? preorder_info = testlib.blockstack_cli_info() names_owned_before = testlib.blockstack_cli_get_names_owned_by_address( wallets[3].addr) for i in xrange(0, 7): testlib.next_block(**kw) # wait for the poller to pick it up print >> sys.stderr, "Waiting 10 seconds for the backend to submit the register" time.sleep(10) # wait for the register to get confirmed for i in xrange(0, 5): testlib.next_block(**kw) # registered? register_info = testlib.blockstack_cli_info() names_info = testlib.blockstack_cli_names() for i in xrange(0, 7): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration" time.sleep(10) # wait for update to get confirmed for i in xrange(0, 5): testlib.next_block(**kw) update_info = testlib.blockstack_cli_info() names_owned_after = testlib.blockstack_cli_get_names_owned_by_address( wallets[3].addr) whois = testlib.blockstack_cli_whois("foo.test") for i in xrange(0, 7): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # put some immutable data put_immutable_info = testlib.blockstack_cli_put_immutable( "foo.test", "hello_world", '{"hello": "world"}') if 'error' in put_immutable_info: print "put_immutable failed" print json.dumps(put_immutable_info, indent=4, sort_keys=True) return False # wait for update to be confirmed for i in xrange(0, 12): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for backend to acknowledge put-immutable update" time.sleep(10) balance_after = testlib.blockstack_cli_balance() blockchain_history = testlib.blockstack_cli_get_name_blockchain_history( "foo.test") zonefile_info = testlib.blockstack_cli_get_name_zonefile("foo.test", json=False) all_names_info = testlib.blockstack_cli_get_all_names(0) namespace_names_info = testlib.blockstack_cli_get_names_in_namespace( "test", 0) lookup_info = testlib.blockstack_cli_lookup("foo.test") update_history = testlib.blockstack_cli_list_update_history("foo.test") zonefile_history = testlib.blockstack_cli_list_zonefile_history("foo.test") blockchain_record = testlib.blockstack_cli_get_name_blockchain_record( "foo.test")