mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-24 03:45:38 +08:00
synchronize with APIs
This commit is contained in:
@@ -140,7 +140,8 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in
|
||||
pk = 'ce100586279d3b127b7dcc137fcc2f18b272bb2b43bdaea3584d0ea17087ec0201'
|
||||
res = testlib.blockstack_cli_app_signin(pk, "ping.app", ["node_read"])
|
||||
pubk = keylib.ECPrivateKey(pk).public_key().to_hex()
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", pk, "ping.app", ["node_read"])
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to signin: {}'.format(res['error'])
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
@@ -163,7 +164,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# access index.html
|
||||
res = testlib.blockstack_REST_call("GET", "/v1/resources/foo.test/ping.app?name=index.html", ses)
|
||||
res = testlib.blockstack_REST_call("GET", "/v1/resources/foo.test/ping.app?name=index.html&pubkey={}".format(pubk), ses)
|
||||
if 'error' in res or res['http_status'] != 200:
|
||||
print 'failed to GET /v1/resources?name=/index.html'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -93,7 +93,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in and make a token
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
@@ -111,7 +111,7 @@ def scenario( wallets, **kw ):
|
||||
file_data = f.read(16384)
|
||||
|
||||
# make datastore
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['disk'] )
|
||||
res = testlib.blockstack_cli_create_datastore( "foo.test", datastore_pk, ['disk'] )
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -119,7 +119,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -127,7 +127,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories again (should fail with EEXIST)
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {} (should fail)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to mkdir {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -143,7 +143,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -155,7 +155,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -174,7 +174,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -182,7 +182,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -194,7 +194,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories again
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -211,7 +211,7 @@ def scenario( wallets, **kw ):
|
||||
# get files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -224,7 +224,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello 2 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -232,7 +232,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again!
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -244,7 +244,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to deletefile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -252,7 +252,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -264,7 +264,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -276,7 +276,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories, 3rd time
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -293,7 +293,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to rmdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -301,7 +301,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -313,7 +313,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all fail)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -325,7 +325,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories again (should fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to rmdir twice: {}'.format(res)
|
||||
return False
|
||||
@@ -336,7 +336,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty
|
||||
print 'listdir {}'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, '/' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -347,7 +347,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete datastore
|
||||
print 'delete datastore'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( "foo.test", datastore_pk )
|
||||
if 'error' in res:
|
||||
print 'failed to delete foo-app.com datastore'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -93,7 +93,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in and make a token
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
@@ -111,7 +111,7 @@ def scenario( wallets, **kw ):
|
||||
file_data = f.read(16384)
|
||||
|
||||
# make datastore
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['disk'] )
|
||||
res = testlib.blockstack_cli_create_datastore( 'foo.test', datastore_pk, ['disk'] )
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -119,7 +119,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -127,7 +127,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories again (should fail with EEXIST)
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {} (should fail)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to mkdir {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -143,7 +143,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -155,7 +155,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -174,7 +174,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -182,7 +182,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -194,7 +194,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories again
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -211,7 +211,7 @@ def scenario( wallets, **kw ):
|
||||
# get files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -224,7 +224,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello 2 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -232,7 +232,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again!
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -244,7 +244,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to deletefile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -252,7 +252,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -264,7 +264,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath, blockchain_id='foo.test' )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -276,7 +276,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories, 3rd time
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -293,7 +293,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to rmdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -301,7 +301,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -313,7 +313,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all fail)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -325,7 +325,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories again (should fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to rmdir twice: {}'.format(res)
|
||||
return False
|
||||
@@ -336,7 +336,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty
|
||||
print 'listdir {}'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, '/', blockchain_id='foo.test' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -347,7 +347,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete datastore
|
||||
print 'delete datastore'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( "foo.test", datastore_pk )
|
||||
if 'error' in res:
|
||||
print 'failed to delete foo-app.com datastore'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -96,7 +96,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in and make a token
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
@@ -114,7 +114,7 @@ def scenario( wallets, **kw ):
|
||||
file_data = f.read(16384)
|
||||
|
||||
# make datastore with two storage drivers
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['disk', 'test'] )
|
||||
res = testlib.blockstack_cli_create_datastore( 'foo.test', datastore_pk, ['disk', 'test'] )
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -122,7 +122,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -130,7 +130,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -142,7 +142,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -160,7 +160,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( 'foo.test', datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -168,7 +168,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -180,7 +180,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories again
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -197,7 +197,7 @@ def scenario( wallets, **kw ):
|
||||
# get files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -210,7 +210,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello 2 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( 'foo.test', datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -218,7 +218,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again!
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -230,7 +230,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to deletefile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -238,7 +238,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -250,7 +250,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -262,7 +262,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories, 3rd time
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -279,7 +279,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to rmdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -287,7 +287,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -299,7 +299,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all fail)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -310,7 +310,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty
|
||||
print 'listdir {}'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, '/' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -321,7 +321,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete datastore
|
||||
print 'delete datastore'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( 'foo.test', datastore_pk )
|
||||
if 'error' in res:
|
||||
print 'failed to delete foo-app.com datastore'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -96,7 +96,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in and make a token
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
@@ -114,7 +114,7 @@ def scenario( wallets, **kw ):
|
||||
file_data = f.read(16384)
|
||||
|
||||
# make datastore with two storage drivers
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['disk', 'test'] )
|
||||
res = testlib.blockstack_cli_create_datastore( 'foo.test', datastore_pk, ['disk', 'test'] )
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -128,7 +128,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories (should all fail, since 'test' is offline; however, 'disk' will have worked)
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to mkdir {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -136,7 +136,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail locally due to ENOENT, since the parent directory will not have been updated)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -148,7 +148,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (all the ones we tried to create should fail due to ENOENT)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -166,7 +166,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories (should succeed)
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -174,7 +174,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories (should fail with EEXIST)
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to mkdir {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -190,7 +190,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should succeed)
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -202,7 +202,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should succeed)
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -220,7 +220,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( 'foo.test', datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -234,7 +234,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should succeed)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (should still work)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -246,7 +246,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories again (should succeed)
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {} (should still work)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -263,7 +263,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should succeed and return latest data)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (should still work)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -276,7 +276,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {} (expect failure)'.format(dpath)
|
||||
data = '{} hello 2 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( 'foo.test', datastore_pk, dpath, data )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -284,7 +284,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should get the new data, despite the failed service)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (should still work)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -303,7 +303,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello 2 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( 'foo.test', datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -311,7 +311,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again! should see results of last put
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -329,7 +329,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files (should fail since 'test' driver is disabled)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally failed to deletefile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -337,7 +337,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should fail, since the idata was removed from 'disk')
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (should fail)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally got {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -349,7 +349,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should still work)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (should still work)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(path, res)
|
||||
return False
|
||||
@@ -363,7 +363,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should still work)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(path, res)
|
||||
return False
|
||||
@@ -371,7 +371,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files (should work now)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to deletefile {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -380,7 +380,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello 3 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( 'foo.test', datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -388,7 +388,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again! should see results of last put
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -407,7 +407,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {} (expect failure)'.format(dpath)
|
||||
data = '{} hello 4 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( 'foo.test', datastore_pk, dpath, data )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to putfile {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -419,7 +419,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again! should see results of last put
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -437,7 +437,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again! should see results of last put
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -449,7 +449,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files (should succeed)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to deletefile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -457,7 +457,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -469,7 +469,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -481,7 +481,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir2', []), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -504,7 +504,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -516,7 +516,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -528,7 +528,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir2', []), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -545,7 +545,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories (should fail, but '/dir2' and '/dir1/dir3/dir4''s idata should be gone)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to rmdir {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -558,7 +558,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should fail for /dir1/dir3/dir4 and /dir2 since its idata got deleted, but it should still work for everyone else)
|
||||
for dpath, expected in [('/dir2', []), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -570,7 +570,7 @@ def scenario( wallets, **kw ):
|
||||
# these should still work
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4'])]:
|
||||
print 'listdir {} (should still work)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -593,7 +593,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories (should succeed)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( 'foo.test', datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to rmdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -601,7 +601,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -613,7 +613,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all fail)
|
||||
for dpath, expected in [('/dir2', []), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -624,7 +624,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty
|
||||
print 'listdir {}'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, '/' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', datastore_id, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -642,7 +642,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete datastore (should fail)
|
||||
print 'delete datastore (expect failure)'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( 'foo.test', datastore_pk )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to delete datastore'
|
||||
print json.dumps(res)
|
||||
@@ -655,7 +655,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
print 'delete datastore'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( 'foo.test', datastore_pk )
|
||||
if 'error' in res:
|
||||
print 'failed to delete foo-app.com datastore'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -91,7 +91,7 @@ def activate_account(blockchain_id, datastore_pk):
|
||||
return False
|
||||
|
||||
# sign in and make a token with the given blockchain ID (whose wallet must be currently set)
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin(blockchain_id, datastore_pk, 'app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
return False
|
||||
@@ -107,7 +107,7 @@ def activate_account(blockchain_id, datastore_pk):
|
||||
|
||||
def core_signin(datastore_pk, blockchain_id):
|
||||
# sign in and make a token with the given blockchain ID (whose wallet must be currently set)
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin(blockchain_id, datastore_pk, 'app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
return False
|
||||
@@ -146,7 +146,7 @@ def setup_datastore(datastore_pk, blockchain_id, write_iteration):
|
||||
return False
|
||||
|
||||
# make datastore
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['test'] )
|
||||
res = testlib.blockstack_cli_create_datastore( blockchain_id, datastore_pk, ['test'])
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -154,7 +154,7 @@ def setup_datastore(datastore_pk, blockchain_id, write_iteration):
|
||||
# make directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( blockchain_id, datastore_pk, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -162,7 +162,7 @@ def setup_datastore(datastore_pk, blockchain_id, write_iteration):
|
||||
# make directories again (should fail with EEXIST)
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {} (should fail)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( blockchain_id, datastore_pk, dpath )
|
||||
if 'error' not in res:
|
||||
print 'accidentally succeeded to mkdir {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -178,7 +178,7 @@ def setup_datastore(datastore_pk, blockchain_id, write_iteration):
|
||||
# stat directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_stat( blockchain_id, datastore_id, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -190,7 +190,7 @@ def setup_datastore(datastore_pk, blockchain_id, write_iteration):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_listdir( blockchain_id, datastore_id, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -206,7 +206,7 @@ def setup_datastore(datastore_pk, blockchain_id, write_iteration):
|
||||
return False
|
||||
|
||||
# put files
|
||||
res = write_datastore(datastore_pk, write_iteration)
|
||||
res = write_datastore(blockchain_id, datastore_pk, write_iteration)
|
||||
if not res:
|
||||
print 'failed to write files (iteration {}) to {}'.format(write_iteration, datastore_id)
|
||||
return False
|
||||
@@ -220,7 +220,7 @@ def setup_datastore(datastore_pk, blockchain_id, write_iteration):
|
||||
return True
|
||||
|
||||
|
||||
def write_datastore(datastore_pk, iteration):
|
||||
def write_datastore(blockchain_id, datastore_pk, iteration):
|
||||
"""
|
||||
write some files to the datastore, over existing ones
|
||||
"""
|
||||
@@ -228,7 +228,7 @@ def write_datastore(datastore_pk, iteration):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello {} {}'.format(file_data, iteration, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( blockchain_id, datastore_pk, dpath, data)
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -244,7 +244,7 @@ def read_datastore(datastore_id, blockchain_id, expected_iteration):
|
||||
# stat files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_stat( blockchain_id, datastore_id, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -256,7 +256,7 @@ def read_datastore(datastore_id, blockchain_id, expected_iteration):
|
||||
# list directories again
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_listdir( blockchain_id, datastore_id, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -273,7 +273,7 @@ def read_datastore(datastore_id, blockchain_id, expected_iteration):
|
||||
# get files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_getfile( blockchain_id, datastore_id, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -285,7 +285,7 @@ def read_datastore(datastore_id, blockchain_id, expected_iteration):
|
||||
return True
|
||||
|
||||
|
||||
def clear_datastore_files(datastore_pk):
|
||||
def clear_datastore_files(blockchain_id, datastore_pk):
|
||||
"""
|
||||
Remove all files from the datastore
|
||||
"""
|
||||
@@ -293,7 +293,7 @@ def clear_datastore_files(datastore_pk):
|
||||
# remove files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( blockchain_id, datastore_pk, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to deletefile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -308,7 +308,7 @@ def check_datastore_files_absent(datastore_id, blockchain_id):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_stat( blockchain_id, datastore_id, dpath)
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -320,7 +320,7 @@ def check_datastore_files_absent(datastore_id, blockchain_id):
|
||||
# get files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_getfile( blockchain_id, datastore_id, dpath)
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -332,7 +332,7 @@ def check_datastore_files_absent(datastore_id, blockchain_id):
|
||||
# list directories, 3rd time
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_listdir( blockchain_id, datastore_id, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -349,14 +349,14 @@ def check_datastore_files_absent(datastore_id, blockchain_id):
|
||||
return True
|
||||
|
||||
|
||||
def clear_datastore_directories(datastore_pk):
|
||||
def clear_datastore_directories(blockchain_id, datastore_pk):
|
||||
"""
|
||||
Clear out the directories of a datastore
|
||||
"""
|
||||
# remove directories
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( blockchain_id, datastore_pk, dpath)
|
||||
if 'error' in res:
|
||||
print 'failed to rmdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -371,7 +371,7 @@ def check_datastore_directories_absent(datastore_id, blockchain_id):
|
||||
# stat directories (should all fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_stat( blockchain_id, datastore_id, dpath)
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -383,7 +383,7 @@ def check_datastore_directories_absent(datastore_id, blockchain_id):
|
||||
# list directories (should all fail)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, blockchain_id=blockchain_id )
|
||||
res = testlib.blockstack_cli_datastore_listdir( blockchain_id, datastore_id, dpath)
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -604,7 +604,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# have foo.test write new files
|
||||
print '\n\nupdate foo.test datastore\n\n'
|
||||
res = write_datastore(foo_datastore_pk, 3)
|
||||
res = write_datastore('foo.test', foo_datastore_pk, 3)
|
||||
if not res:
|
||||
print 'failed to update foo.test datastore {}'.format(foo_datastore_id)
|
||||
return False
|
||||
@@ -631,7 +631,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# have bar write some new files
|
||||
print '\n\nupdate bar.test datastore\n\n'
|
||||
res = write_datastore(bar_datastore_pk, 4)
|
||||
res = write_datastore('bar.test', bar_datastore_pk, 4)
|
||||
if not res:
|
||||
print 'failed ot update bar.test datastore {}'.format(bar_datastore_id)
|
||||
return False
|
||||
@@ -644,7 +644,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete foo's files
|
||||
print '\n\ndelete foo.test files\n\n'
|
||||
res = clear_datastore_files(foo_datastore_pk)
|
||||
res = clear_datastore_files('foo.test', foo_datastore_pk)
|
||||
if not res:
|
||||
print 'failed to clear datastore {} for foo.test'.format(foo_datastore_id)
|
||||
return False
|
||||
@@ -670,7 +670,7 @@ def scenario( wallets, **kw ):
|
||||
target_datastore('bar.test')
|
||||
|
||||
# clear bar.test's files
|
||||
res = clear_datastore_files(bar_datastore_pk)
|
||||
res = clear_datastore_files('bar.test', bar_datastore_pk)
|
||||
if not res:
|
||||
print 'failed to clear datastore {} for bar.test'.format(bar_datastore_id)
|
||||
return False
|
||||
@@ -696,7 +696,7 @@ def scenario( wallets, **kw ):
|
||||
target_datastore("foo.test")
|
||||
|
||||
# clear foo's directories
|
||||
res = clear_datastore_directories(foo_datastore_pk)
|
||||
res = clear_datastore_directories('foo.test', foo_datastore_pk)
|
||||
if not res:
|
||||
print 'failed to clear foo.test datastore {} of directories'.format(foo_datastore_id)
|
||||
return False
|
||||
@@ -722,7 +722,7 @@ def scenario( wallets, **kw ):
|
||||
target_datastore('bar.test')
|
||||
|
||||
# clear bar's directories
|
||||
res = clear_datastore_directories(bar_datastore_pk)
|
||||
res = clear_datastore_directories('bar.test', bar_datastore_pk)
|
||||
if not res:
|
||||
print 'failed to clear bar.test datastore {} of directories'.format(bar_datastore_id)
|
||||
return False
|
||||
@@ -746,7 +746,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty in both cases
|
||||
print 'listdir {} (bar.test)'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( bar_datastore_id, '/', blockchain_id="bar.test" )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'bar.test', bar_datastore_id, '/')
|
||||
if 'error' in res:
|
||||
print 'failed to listdir / on bar.test: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -762,7 +762,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
print 'listdir {} (foo.test)'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( foo_datastore_id, '/', blockchain_id="foo.test" )
|
||||
res = testlib.blockstack_cli_datastore_listdir( 'foo.test', foo_datastore_id, '/')
|
||||
if 'error' in res:
|
||||
print 'failed to listdir / on foo.test: {}'.format(res['error'])
|
||||
return False
|
||||
|
||||
@@ -93,7 +93,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in and make a token
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
@@ -106,7 +106,7 @@ def scenario( wallets, **kw ):
|
||||
datastore_id = datastore_id_res['datastore_id']
|
||||
|
||||
# make datastore
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['disk'] )
|
||||
res = testlib.blockstack_cli_create_datastore( 'foo.test', datastore_pk, ['disk'] )
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -114,7 +114,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -122,7 +122,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -134,7 +134,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -152,7 +152,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = 'hello {}'.format(os.path.basename(dpath))
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -160,7 +160,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -172,7 +172,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories again
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -189,7 +189,7 @@ def scenario( wallets, **kw ):
|
||||
# get files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -199,7 +199,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# remove root
|
||||
res = testlib.blockstack_cli_datastore_rmtree( datastore_pk, '/' )
|
||||
res = testlib.blockstack_cli_datastore_rmtree( "foo.test", datastore_pk, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to rmtree /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -207,7 +207,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -219,7 +219,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -231,7 +231,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -243,7 +243,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all fail)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -254,7 +254,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty
|
||||
print 'listdir {}'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, '/' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -265,7 +265,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete datastore
|
||||
print 'delete datastore'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( "foo.test", datastore_pk )
|
||||
if 'error' in res:
|
||||
print 'failed to delete foo-app.com datastore'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -95,7 +95,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in and make a token
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
@@ -113,7 +113,7 @@ def scenario( wallets, **kw ):
|
||||
file_data = f.read(16384)
|
||||
|
||||
# make datastore
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['disk'] )
|
||||
res = testlib.blockstack_cli_create_datastore( 'foo.test', datastore_pk, ['disk'] )
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -121,7 +121,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -129,7 +129,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -141,7 +141,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -166,7 +166,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -174,7 +174,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -186,7 +186,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories again
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -203,7 +203,7 @@ def scenario( wallets, **kw ):
|
||||
# get files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -216,7 +216,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello 2 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir)
|
||||
@@ -225,7 +225,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again!
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir)
|
||||
@@ -245,7 +245,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail with ESTALE)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -259,7 +259,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (expect failure with ESTALE)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to getfile {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -273,7 +273,7 @@ def scenario( wallets, **kw ):
|
||||
# get files with force (expect failure with ENOENT, since dirs don't have them)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile force=1 {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath, force=True )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -285,7 +285,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (with force)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath, force=True )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -297,7 +297,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (expect failure due to stale directories)
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to listdir {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -311,7 +311,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (with force) Expect no files
|
||||
for dpath, expected in [('/', ['file1', 'file2']), ('/dir1', ['file3']), ('/dir1/dir3', ['file4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir force=1 {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath, force=True )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -328,7 +328,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files, with force (should still fail, but with ENOENT)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( "foo.test", datastore_pk, dpath, force=True )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to listdir {}: {}'.format(dpath, res)
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -342,7 +342,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories (should all fail with ESTALE)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to rmdir {}: {}'.format(dpath, res)
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -356,7 +356,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories with force (should succeed)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir force=1 {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( "foo.test", datastore_pk, dpath, force=True )
|
||||
if 'error' in res:
|
||||
print 'failed to remove {}: {}'.format(dpath, res)
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -365,7 +365,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail with ENOENT)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -377,7 +377,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all fail with ENOENT now)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -388,7 +388,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty
|
||||
print 'listdir {}'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, '/' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -399,7 +399,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete datastore
|
||||
print 'delete datastore'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( "foo.test", datastore_pk )
|
||||
if 'error' in res:
|
||||
print 'failed to delete foo-app.com datastore'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -95,7 +95,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# sign in and make a token
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'foo-app.com', ['store_read', 'store_write', 'store_admin'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
@@ -113,7 +113,7 @@ def scenario( wallets, **kw ):
|
||||
file_data = f.read(16384)
|
||||
|
||||
# make datastore
|
||||
res = testlib.blockstack_cli_create_datastore( datastore_pk, ['disk'] )
|
||||
res = testlib.blockstack_cli_create_datastore( 'foo.test', datastore_pk, ['disk'] )
|
||||
if 'error' in res:
|
||||
print "failed to create datastore: {}".format(res['error'])
|
||||
return False
|
||||
@@ -121,7 +121,7 @@ def scenario( wallets, **kw ):
|
||||
# make directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'mkdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_mkdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_mkdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to mkdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -129,7 +129,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories
|
||||
for dpath in ['/dir1', '/dir2', '/dir1/dir3', '/dir1/dir3/dir4']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -141,7 +141,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -159,7 +159,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -167,7 +167,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -179,7 +179,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories again
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -196,7 +196,7 @@ def scenario( wallets, **kw ):
|
||||
# get files
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -216,7 +216,7 @@ def scenario( wallets, **kw ):
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'putfile {}'.format(dpath)
|
||||
data = '{} hello 2 {}'.format(file_data, dpath)
|
||||
res = testlib.blockstack_cli_datastore_putfile( datastore_pk, dpath, data )
|
||||
res = testlib.blockstack_cli_datastore_putfile( "foo.test", datastore_pk, dpath, data )
|
||||
if 'error' in res:
|
||||
print 'failed to putfile {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir)
|
||||
@@ -225,7 +225,7 @@ def scenario( wallets, **kw ):
|
||||
# get files again!
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir)
|
||||
@@ -245,7 +245,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files (should all fail)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -259,7 +259,7 @@ def scenario( wallets, **kw ):
|
||||
# get files (expect failure)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to getfile {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -273,7 +273,7 @@ def scenario( wallets, **kw ):
|
||||
# get files with force
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile force=1 {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath, force=True )
|
||||
if 'error' in res:
|
||||
print 'failed to getfile {} force=1: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -288,7 +288,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (with force)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath, force=True )
|
||||
if 'error' in res:
|
||||
print 'failed to stat {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -300,7 +300,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (expect failure due to stale directories)
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir force=1 {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to listdir {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -314,7 +314,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (with force)
|
||||
for dpath, expected in [('/', ['dir1', 'dir2', 'file1', 'file2']), ('/dir1', ['dir3', 'file3']), ('/dir1/dir3', ['dir4', 'file4']), ('/dir1/dir3/dir4', ['file5'])]:
|
||||
print 'listdir force=1 {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath, force=True )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -331,7 +331,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files (should fail, unless we give 'force=1')
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( "foo.test", datastore_pk, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to deletefile {}: {}'.format(dpath, res['error'])
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -345,7 +345,7 @@ def scenario( wallets, **kw ):
|
||||
# remove files, with force
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'deletefile {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_deletefile( datastore_pk, dpath, force=True )
|
||||
res = testlib.blockstack_cli_datastore_deletefile( "foo.test", datastore_pk, dpath, force=True )
|
||||
if 'errno' in res:
|
||||
print 'failed to deletefile {}: {}'.format(dpath, res)
|
||||
shutil.rmtree(backup_dir_2)
|
||||
@@ -354,7 +354,7 @@ def scenario( wallets, **kw ):
|
||||
# stat files in affected (should all fail with ENOENT, since we updated the directories)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -366,7 +366,7 @@ def scenario( wallets, **kw ):
|
||||
# get files in affected directoies (should all fail with ENOENT since we updated the directories)
|
||||
for dpath in ['/file1', '/file2', '/dir1/file3', '/dir1/dir3/file4', '/dir1/dir3/dir4/file5']:
|
||||
print 'getfile {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_getfile( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_getfile( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to get {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -378,7 +378,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all succeed since we updated the directories)
|
||||
for dpath, expected in [('/', ['dir1', 'dir2']), ('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -395,7 +395,7 @@ def scenario( wallets, **kw ):
|
||||
# remove directories (should all succeed since we updated directories)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'rmdir {}'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_rmdir( datastore_pk, dpath )
|
||||
res = testlib.blockstack_cli_datastore_rmdir( "foo.test", datastore_pk, dpath )
|
||||
if 'error' in res:
|
||||
print 'failed to rmdir {}: {}'.format(dpath, res['error'])
|
||||
return False
|
||||
@@ -403,7 +403,7 @@ def scenario( wallets, **kw ):
|
||||
# stat directories (should all fail with ENOENT)
|
||||
for dpath in ['/dir1/dir3/dir4', '/dir1/dir3', '/dir2', '/dir1']:
|
||||
print 'stat {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_stat( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_stat( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to stat {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -415,7 +415,7 @@ def scenario( wallets, **kw ):
|
||||
# list directories (should all fail with ENOENT now)
|
||||
for dpath, expected in [('/dir1', ['dir3']), ('/dir1/dir3', ['dir4']), ('/dir1/dir3/dir4', [])]:
|
||||
print 'listdir {} (expect failure)'.format(dpath)
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, dpath )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, dpath )
|
||||
if 'error' not in res or 'errno' not in res:
|
||||
print 'accidentally succeeded to list {}: {}'.format(dpath, res)
|
||||
return False
|
||||
@@ -426,7 +426,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# root should be empty
|
||||
print 'listdir {}'.format('/')
|
||||
res = testlib.blockstack_cli_datastore_listdir( datastore_id, '/' )
|
||||
res = testlib.blockstack_cli_datastore_listdir( "foo.test", datastore_id, '/' )
|
||||
if 'error' in res:
|
||||
print 'failed to listdir /: {}'.format(res['error'])
|
||||
return False
|
||||
@@ -437,7 +437,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# delete datastore
|
||||
print 'delete datastore'
|
||||
res = testlib.blockstack_cli_delete_datastore( datastore_pk )
|
||||
res = testlib.blockstack_cli_delete_datastore( "foo.test", datastore_pk )
|
||||
if 'error' in res:
|
||||
print 'failed to delete foo-app.com datastore'
|
||||
print json.dumps(res)
|
||||
|
||||
@@ -96,7 +96,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# make a session
|
||||
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'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", 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
|
||||
|
||||
@@ -97,7 +97,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# make a session
|
||||
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'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", 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
|
||||
|
||||
@@ -182,7 +182,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# make a session
|
||||
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'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", 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
|
||||
|
||||
@@ -96,7 +96,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# make a session
|
||||
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'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", 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
|
||||
|
||||
@@ -99,7 +99,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# make a session
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'prices', 'revoke', 'zonefiles', 'blockchain', 'node_read'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'register.app', ['names', 'register', 'prices', 'revoke', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
|
||||
@@ -98,7 +98,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# make a session
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'transfer', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'register.app', ['names', 'register', 'transfer', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
|
||||
@@ -98,7 +98,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# make a session
|
||||
datastore_pk = keylib.ECPrivateKey(wallets[-1].privkey).to_hex()
|
||||
res = testlib.blockstack_cli_app_signin(datastore_pk, 'register.app', ['names', 'register', 'update', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
res = testlib.blockstack_cli_app_signin("foo.test", datastore_pk, 'register.app', ['names', 'register', 'update', 'prices', 'zonefiles', 'blockchain', 'node_read'])
|
||||
if 'error' in res:
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
|
||||
@@ -1708,7 +1708,7 @@ def blockstack_cli_app_put_resource( blockchain_id, app_domain, res_path, res_fi
|
||||
return cli_app_put_resource( args, config_path=config_path, interactive=interactive, password=password, proxy=test_proxy )
|
||||
|
||||
|
||||
def blockstack_cli_app_signin( app_privkey, app_domain, api_methods, config_path=None ):
|
||||
def blockstack_cli_app_signin( blockchain_id, app_privkey, app_domain, api_methods, device_ids=None, public_keys=None, config_path=None ):
|
||||
"""
|
||||
sign in and get a token
|
||||
"""
|
||||
@@ -1719,14 +1719,24 @@ def blockstack_cli_app_signin( app_privkey, app_domain, api_methods, config_path
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.app_domain = app_domain
|
||||
args.api_methods = ','.join(api_methods)
|
||||
args.privkey = app_privkey
|
||||
|
||||
if device_ids is None and public_keys is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
public_keys = [keylib.ECPrivateKey(app_privkey).public_key().to_hex()]
|
||||
|
||||
device_ids = ','.join(device_ids)
|
||||
public_keys = ','.join(public_keys)
|
||||
args.device_ids = device_ids
|
||||
args.public_keys = public_keys
|
||||
|
||||
return cli_app_signin( args, config_path=config_path )
|
||||
|
||||
|
||||
def blockstack_cli_create_datastore(datastore_privkey, drivers, config_path=None):
|
||||
def blockstack_cli_create_datastore(blockchain_id, datastore_privkey, drivers, device_ids=None, config_path=None):
|
||||
"""
|
||||
create_datastore
|
||||
"""
|
||||
@@ -1737,13 +1747,19 @@ def blockstack_cli_create_datastore(datastore_privkey, drivers, config_path=None
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.privkey = datastore_privkey
|
||||
args.drivers = ",".join(drivers)
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_create_datastore( args, config_path=config_path)
|
||||
|
||||
|
||||
def blockstack_cli_delete_datastore(datastore_privkey, force=False, config_path=None):
|
||||
def blockstack_cli_delete_datastore(blockchain_id, datastore_privkey, force=False, device_ids=None, config_path=None):
|
||||
"""
|
||||
delete datastore
|
||||
"""
|
||||
@@ -1753,13 +1769,19 @@ def blockstack_cli_delete_datastore(datastore_privkey, force=False, config_path=
|
||||
config_path = test_proxy.config_path if config_path is None else config_path
|
||||
|
||||
args = CLIArgs()
|
||||
args.blockchain_id = blockchain_id
|
||||
args.privkey = datastore_privkey
|
||||
args.force = '1' if force else '0'
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_delete_datastore( args, config_path=config_path )
|
||||
|
||||
|
||||
def blockstack_cli_datastore_mkdir(datastore_privkey, path, config_path=None, interactive=False ):
|
||||
def blockstack_cli_datastore_mkdir(blockchain_id, datastore_privkey, path, device_ids=None, config_path=None, interactive=False ):
|
||||
"""
|
||||
mkdir
|
||||
"""
|
||||
@@ -1769,14 +1791,20 @@ def blockstack_cli_datastore_mkdir(datastore_privkey, path, config_path=None, in
|
||||
config_path = test_proxy.config_path if config_path is None else config_path
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.path = path
|
||||
args.privkey = datastore_privkey
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_datastore_mkdir( args, config_path=config_path, interactive=interactive )
|
||||
|
||||
|
||||
def blockstack_cli_datastore_rmdir( datastore_privkey, path, config_path=None, force=False, interactive=False ):
|
||||
def blockstack_cli_datastore_rmdir( blockchain_id, datastore_privkey, path, device_ids=None, config_path=None, force=False, interactive=False ):
|
||||
"""
|
||||
rmdir
|
||||
"""
|
||||
@@ -1786,15 +1814,20 @@ def blockstack_cli_datastore_rmdir( datastore_privkey, path, config_path=None, f
|
||||
config_path = test_proxy.config_path if config_path is None else config_path
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.path = path
|
||||
args.privkey = datastore_privkey
|
||||
args.force = '1' if force else '0'
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_datastore_rmdir( args, config_path=config_path, interactive=interactive )
|
||||
|
||||
|
||||
def blockstack_cli_datastore_rmtree( datastore_privkey, path, config_path=None, interactive=False ):
|
||||
def blockstack_cli_datastore_rmtree( blockchain_id, datastore_privkey, path, device_ids=None, config_path=None, interactive=False ):
|
||||
"""
|
||||
rmtree
|
||||
"""
|
||||
@@ -1804,14 +1837,20 @@ def blockstack_cli_datastore_rmtree( datastore_privkey, path, config_path=None,
|
||||
config_path = test_proxy.config_path if config_path is None else config_path
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.path = path
|
||||
args.privkey = datastore_privkey
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_datastore_rmtree( args, config_path=config_path, interactive=interactive )
|
||||
|
||||
|
||||
def blockstack_cli_datastore_listdir(datastore_id, path, blockchain_id=None, config_path=None, force=False, interactive=False ):
|
||||
def blockstack_cli_datastore_listdir(blockchain_id, datastore_id, path, device_ids=None, config_path=None, force=False, interactive=False ):
|
||||
"""
|
||||
listdir
|
||||
"""
|
||||
@@ -1822,17 +1861,20 @@ def blockstack_cli_datastore_listdir(datastore_id, path, blockchain_id=None, con
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
if blockchain_id:
|
||||
args.blockchain_id = blockchain_id
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.datastore_id = datastore_id
|
||||
args.path = path
|
||||
args.force = '1' if force else '0'
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_datastore_listdir( args, config_path=config_path, interactive=interactive )
|
||||
|
||||
|
||||
def blockstack_cli_datastore_stat( datastore_id, path, blockchain_id=None, config_path=None, force=False, interactive=False ):
|
||||
def blockstack_cli_datastore_stat( blockchain_id, datastore_id, path, device_ids=None, config_path=None, force=False, interactive=False ):
|
||||
"""
|
||||
stat
|
||||
"""
|
||||
@@ -1843,17 +1885,20 @@ def blockstack_cli_datastore_stat( datastore_id, path, blockchain_id=None, confi
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
if blockchain_id:
|
||||
args.blockchain_id = blockchain_id
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.datastore_id = datastore_id
|
||||
args.path = path
|
||||
args.force = '1' if force else '0'
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_datastore_stat( args, config_path=config_path, interactive=interactive )
|
||||
|
||||
|
||||
def blockstack_cli_datastore_getfile( datastore_id, path, blockchain_id=None, config_path=None, force=False, interactive=False ):
|
||||
def blockstack_cli_datastore_getfile( blockchain_id, datastore_id, path, device_ids=None, config_path=None, force=False, interactive=False ):
|
||||
"""
|
||||
getfile
|
||||
"""
|
||||
@@ -1864,18 +1909,21 @@ def blockstack_cli_datastore_getfile( datastore_id, path, blockchain_id=None, co
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
if blockchain_id:
|
||||
args.blockchain_id = blockchain_id
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.datastore_id = datastore_id
|
||||
args.path = path
|
||||
args.force = '1' if force else '0'
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
data = cli_datastore_getfile( args, config_path=config_path, interactive=interactive )
|
||||
return data
|
||||
|
||||
|
||||
def blockstack_cli_datastore_putfile( datastore_privkey, path, data, data_path=None, interactive=False, force=False, proxy=None, config_path=None):
|
||||
def blockstack_cli_datastore_putfile( blockchain_id, datastore_privkey, path, data, device_ids=None, data_path=None, interactive=False, force=False, proxy=None, config_path=None):
|
||||
"""
|
||||
putfile
|
||||
"""
|
||||
@@ -1885,16 +1933,22 @@ def blockstack_cli_datastore_putfile( datastore_privkey, path, data, data_path=N
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.privkey = datastore_privkey
|
||||
args.path = path
|
||||
args.data = data
|
||||
args.data_path = data_path
|
||||
args.force = '1' if force else '0'
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
return cli_datastore_putfile( args, config_path=config_path, interactive=interactive )
|
||||
|
||||
|
||||
def blockstack_cli_datastore_deletefile( datastore_privkey, path, interactive=False, force=False, proxy=None, config_path=None):
|
||||
def blockstack_cli_datastore_deletefile( blockchain_id, datastore_privkey, path, device_ids=None, interactive=False, force=False, proxy=None, config_path=None):
|
||||
"""
|
||||
deletefile
|
||||
"""
|
||||
@@ -1904,10 +1958,17 @@ def blockstack_cli_datastore_deletefile( datastore_privkey, path, interactive=Fa
|
||||
|
||||
args = CLIArgs()
|
||||
|
||||
args.blockchain_id = blockchain_id
|
||||
args.privkey = datastore_privkey
|
||||
args.path = path
|
||||
args.force = '1' if force else '0'
|
||||
|
||||
if device_ids is None:
|
||||
device_ids = [blockstack_client.config.get_local_device_id()]
|
||||
|
||||
args.device_ids = ','.join(device_ids)
|
||||
|
||||
|
||||
return cli_datastore_deletefile( args, config_path=config_path, interactive=interactive )
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user