mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-13 22:38:00 +08:00
fix expect_fail-related bugs
This commit is contained in:
@@ -163,7 +163,7 @@ def scenario( wallets, **kw ):
|
||||
# begin epoch 3 (grace period)
|
||||
testlib.next_block(**kw) # end of 697
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -187,7 +187,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -210,7 +210,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -233,7 +233,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -258,7 +258,7 @@ def scenario( wallets, **kw ):
|
||||
print whois
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
|
||||
@@ -147,7 +147,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -156,7 +156,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # end of 697
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -164,7 +164,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # 698
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -172,7 +172,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # 699
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -180,7 +180,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # 700
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
|
||||
@@ -228,7 +228,7 @@ def scenario( wallets, **kw ):
|
||||
print json.dumps(whois)
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -257,7 +257,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -285,7 +285,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -320,7 +320,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[3].privkey, wallets[0].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[3].privkey, wallets[0].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
|
||||
@@ -152,7 +152,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -161,7 +161,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # end of 697
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -169,7 +169,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # 698
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -177,7 +177,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # 699
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -185,7 +185,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # 700
|
||||
|
||||
# safety checks should NOT allow the preorder to go through
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr)
|
||||
resp = testlib.blockstack_name_preorder('foo.test', wallets[3].privkey, wallets[4].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
|
||||
@@ -172,7 +172,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # end of 696. Name should be expired
|
||||
|
||||
# update should be impossible, since we're now in the renewal period
|
||||
resp = testlib.blockstack_name_update( 'foo.test', '66' * 20, wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_update( 'foo.test', '66' * 20, wallets[4].privkey, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
|
||||
@@ -95,7 +95,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# should be rejected if not burned
|
||||
res = testlib.blockstack_name_renew('foo.test', wallets[3].privkey, burn_addr=namespace_rec['address'])
|
||||
res = testlib.blockstack_name_renew('foo.test', wallets[3].privkey, burn_addr=namespace_rec['address'], expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
@@ -182,7 +182,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw) # end of 696. Name should be expired
|
||||
|
||||
# update should be impossible, since we're now in the renewal period
|
||||
resp = testlib.blockstack_name_update( 'foo.test', '66' * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( 'foo.test', '66' * 20, wallets[3].privkey, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
|
||||
@@ -55,14 +55,11 @@ def scenario( wallets, **kw ):
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.next_block( **kw ) # 692
|
||||
|
||||
'''
|
||||
# no longer a relevant test, since we're in epoch 3 now
|
||||
# should fail (safety checks stop it)
|
||||
resp = testlib.blockstack_name_register('foo.test', wallets[2].privkey, wallets[3].addr, zonefile_hash='22' * 20)
|
||||
resp = testlib.blockstack_name_register('foo.test', wallets[2].privkey, wallets[3].addr, zonefile_hash='22' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
'''
|
||||
|
||||
# should succeed in being sent, but will be rejected
|
||||
resp = testlib.blockstack_name_register('foo.test', wallets[2].privkey, wallets[3].addr, zonefile_hash='22' * 20, safety_checks=False, tx_fee=300 * 5)
|
||||
|
||||
@@ -63,13 +63,11 @@ def scenario( wallets, **kw ):
|
||||
print whois
|
||||
return False
|
||||
|
||||
''' not relevant anymore, since this tests an old CLI
|
||||
# should fail (safety checks stop it)
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, zonefile_hash='22' * 20, recipient_addr=wallets[0].addr )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, zonefile_hash='22' * 20, recipient_addr=wallets[0].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
'''
|
||||
|
||||
# should succeed in being sent
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, zonefile_hash='22' * 20, recipient_addr=wallets[0].addr, safety_checks=False, tx_fee=10000 * 5 )
|
||||
|
||||
@@ -63,13 +63,11 @@ def scenario( wallets, **kw ):
|
||||
print whois
|
||||
return False
|
||||
|
||||
''' this only applies to the old CLI
|
||||
# should fail (safety checks stop it)
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, zonefile_hash='22' * 20, recipient_addr=wallets[0].addr )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, zonefile_hash='22' * 20, recipient_addr=wallets[0].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
'''
|
||||
|
||||
# should succeed in being sent
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, zonefile_hash='22' * 20, recipient_addr=wallets[0].addr, safety_checks=False, tx_fee=10000 * 5 )
|
||||
|
||||
@@ -144,7 +144,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# try forcing it to the namespace burn address, to verify that it fails
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'] )
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[4].privkey, wallets[0].addr, burn_addr=namespace_rec['address'], expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
@@ -75,12 +75,10 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block(**kw)
|
||||
testlib.next_block(**kw)
|
||||
|
||||
'''
|
||||
res = testlib.blockstack_name_update("foo.test", '22' * 20, wallets[3].privkey)
|
||||
res = testlib.blockstack_name_update("foo.test", '22' * 20, wallets[3].privkey, expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
'''
|
||||
|
||||
res = testlib.blockstack_name_update("foo.test", '22' * 20, wallets[3].privkey, safety_checks=False, tx_fee=300*5)
|
||||
if 'error' in res:
|
||||
@@ -101,7 +99,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# can't transfer
|
||||
res = testlib.blockstack_name_transfer('foo.test', wallets[4].addr, True, wallets[3].privkey)
|
||||
res = testlib.blockstack_name_transfer('foo.test', wallets[4].addr, True, wallets[3].privkey, expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
@@ -125,7 +123,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# can't revoke
|
||||
res = testlib.blockstack_name_revoke('foo.test', wallets[3].privkey)
|
||||
res = testlib.blockstack_name_revoke('foo.test', wallets[3].privkey, expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
@@ -219,7 +219,7 @@ def scenario( wallets, **kw ):
|
||||
print json.dumps(whois)
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -248,7 +248,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -276,7 +276,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -304,7 +304,7 @@ def scenario( wallets, **kw ):
|
||||
print 'accidentally registered'
|
||||
return False
|
||||
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
@@ -334,12 +334,10 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
'''
|
||||
|
||||
'''
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20)
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print resp
|
||||
return False
|
||||
'''
|
||||
|
||||
# should go through, but be rejected
|
||||
resp = testlib.blockstack_name_register("foo.test", wallets[1].privkey, wallets[2].addr, zonefile_hash='44' * 20, safety_checks=False, tx_fee=500*5)
|
||||
|
||||
@@ -95,7 +95,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# preorder should send to the null burn address now.
|
||||
# try forcing it to the namespace burn address, to verify that it fails
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[2].privkey, wallets[3].addr, burn_addr=namespace_rec['address'] )
|
||||
res = testlib.blockstack_name_preorder( "foo_fail.test", wallets[2].privkey, wallets[3].addr, burn_addr=namespace_rec['address'], expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
@@ -62,7 +62,7 @@ def scenario( wallets, **kw ):
|
||||
namespace_balance = testlib.get_balance(namespace_rec['address'])
|
||||
|
||||
# should fail safety checks
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr, burn_addr=wallets[1].addr )
|
||||
res = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr, burn_addr=wallets[1].addr, expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
@@ -107,7 +107,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# should be rejected if not burned
|
||||
res = testlib.blockstack_name_renew('foo.test', wallets[3].privkey, burn_addr=namespace_rec['address'])
|
||||
res = testlib.blockstack_name_renew('foo.test', wallets[3].privkey, burn_addr=namespace_rec['address'], expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
@@ -123,7 +123,7 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# should be rejected if not burned
|
||||
res = testlib.blockstack_name_renew('foo.test', wallets[3].privkey, burn_addr=namespace_rec['address'])
|
||||
res = testlib.blockstack_name_renew('foo.test', wallets[3].privkey, burn_addr=namespace_rec['address'], expect_fail=True)
|
||||
if 'error' not in res:
|
||||
print res
|
||||
return False
|
||||
|
||||
@@ -67,7 +67,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.expect_snv_fail_at('foo26.test', testlib.get_current_block(**kw))
|
||||
|
||||
# safety checks should prohibit this
|
||||
resp = testlib.blockstack_name_preorder( "bar.test", wallets[2].privkey, wallets[3].addr )
|
||||
resp = testlib.blockstack_name_preorder( "bar.test", wallets[2].privkey, wallets[3].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print 'safety check failure on preorder'
|
||||
print json.dumps( resp, indent=4 )
|
||||
@@ -81,7 +81,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# safety checks should prohibit this
|
||||
resp = testlib.blockstack_name_register( "bar.test", wallets[2].privkey, wallets[3].addr)
|
||||
resp = testlib.blockstack_name_register( "bar.test", wallets[2].privkey, wallets[3].addr, expect_fail=True)
|
||||
if 'error' not in resp:
|
||||
print 'safety check failure'
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user