use new signin API to generate session tokens

This commit is contained in:
Jude Nelson
2017-03-16 11:36:26 -04:00
parent 74a71368f0
commit 99f73589bb
6 changed files with 43 additions and 37 deletions

View File

@@ -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 )

View File

@@ -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)

View File

@@ -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 )

View File

@@ -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'})

View File

@@ -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:

View File

@@ -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'})