mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-17 22:24:34 +08:00
use new signin API to generate session tokens
This commit is contained in:
@@ -96,13 +96,14 @@ def scenario( wallets, **kw ):
|
||||
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG", None)
|
||||
|
||||
# make a session
|
||||
ses = testlib.blockstack_app_session( "register.app", ["names","register","prices","zonefiles","blockchain","node_read"], config_path=config_path )
|
||||
if 'error' in ses:
|
||||
ses['test'] = 'Failed to get app session'
|
||||
print json.dumps(ses)
|
||||
return False
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
return
|
||||
|
||||
ses = ses['ses']
|
||||
ses = res['token']
|
||||
|
||||
# for funsies, get the price of .test
|
||||
res = testlib.blockstack_REST_call('GET', '/v1/prices/namespaces/test', ses )
|
||||
|
||||
@@ -97,13 +97,14 @@ def scenario( wallets, **kw ):
|
||||
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG", None)
|
||||
|
||||
# make a session
|
||||
ses = testlib.blockstack_app_session( "register.app", ["names","register","prices","zonefiles","blockchain","node_read"], config_path=config_path )
|
||||
if 'error' in ses:
|
||||
ses['test'] = 'Failed to get app session'
|
||||
print json.dumps(ses)
|
||||
return False
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
return
|
||||
|
||||
ses = ses['ses']
|
||||
ses = res['token']
|
||||
|
||||
# for funsies, get the price of .test
|
||||
res = testlib.blockstack_REST_call('GET', '/v1/prices/namespaces/test', ses)
|
||||
|
||||
@@ -96,13 +96,14 @@ def scenario( wallets, **kw ):
|
||||
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG", None)
|
||||
|
||||
# make a session
|
||||
ses = testlib.blockstack_app_session( "register.app", ["names","register","prices","zonefiles","blockchain","node_read"], config_path=config_path )
|
||||
if 'error' in ses:
|
||||
ses['test'] = 'Failed to get app session'
|
||||
print json.dumps(ses)
|
||||
return False
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
return
|
||||
|
||||
ses = ses['ses']
|
||||
ses = res['token']
|
||||
|
||||
# for funsies, get the price of .test
|
||||
res = testlib.blockstack_REST_call('GET', '/v1/prices/namespaces/test', ses )
|
||||
|
||||
@@ -99,13 +99,14 @@ def scenario( wallets, **kw ):
|
||||
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG", None)
|
||||
|
||||
# make a session
|
||||
ses = testlib.blockstack_app_session( "register.app", ["names","revoke","register","prices","zonefiles","blockchain","node_read"], config_path=config_path )
|
||||
if 'error' in ses:
|
||||
ses['test'] = 'Failed to get app session'
|
||||
print json.dumps(ses)
|
||||
return False
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
return
|
||||
|
||||
ses = ses['ses']
|
||||
ses = res['token']
|
||||
|
||||
# register the name bar.test
|
||||
res = testlib.blockstack_REST_call('POST', '/v1/names', ses, data={'name': 'bar.test'})
|
||||
|
||||
@@ -98,14 +98,15 @@ def scenario( wallets, **kw ):
|
||||
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG", None)
|
||||
|
||||
# make a session
|
||||
ses = testlib.blockstack_app_session( "register.app", ["names","register",'transfer',"prices","zonefiles","blockchain","node_read"], config_path=config_path )
|
||||
if 'error' in ses:
|
||||
ses['test'] = 'Failed to get app session'
|
||||
print json.dumps(ses)
|
||||
return False
|
||||
|
||||
ses = ses['ses']
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
return
|
||||
|
||||
ses = res['token']
|
||||
|
||||
# register the name bar.test
|
||||
res = testlib.blockstack_REST_call('POST', '/v1/names', ses, data={'name': 'bar.test'})
|
||||
if 'error' in res:
|
||||
|
||||
@@ -98,13 +98,14 @@ def scenario( wallets, **kw ):
|
||||
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG", None)
|
||||
|
||||
# make a session
|
||||
ses = testlib.blockstack_app_session( "register.app", ["names","register","prices","zonefiles","update","blockchain","node_read"], config_path=config_path )
|
||||
if 'error' in ses:
|
||||
ses['test'] = 'Failed to get app session'
|
||||
print json.dumps(ses)
|
||||
return False
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
return
|
||||
|
||||
ses = ses['ses']
|
||||
ses = res['token']
|
||||
|
||||
# register the name bar.test
|
||||
res = testlib.blockstack_REST_call('POST', '/v1/names', ses, data={'name': 'bar.test'})
|
||||
|
||||
Reference in New Issue
Block a user