Skip to content

Commit

Permalink
[INDY-1939] review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Nikitin <[email protected]>
  • Loading branch information
Andrew Nikitin committed Jan 16, 2019
1 parent f0dfe57 commit 0e7fa92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
10 changes: 8 additions & 2 deletions indy_node/test/nym_txn/test_demote_network_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,28 @@ def test_network_monitor_suspension_by_another_steward(looper,
did.create_and_store_my_did(sdk_wallet_trustee[0], "{}"))
new_network_monitor_did, new_network_monitor_verkey = looper.loop.run_until_complete(
did.create_and_store_my_did(sdk_wallet_steward[0], "{}"))

"""Adding new steward"""
sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee, 'newSteward', STEWARD_STRING, verkey=new_steward_verkey, dest=new_steward_did)

"""Adding NETWORK_MONITOR role by first steward"""
op = {'type': '1',
'dest': new_network_monitor_did,
'role': NETWORK_MONITOR,
'verkey': new_network_monitor_verkey}
req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, new_steward_did), op)
sdk_get_and_check_replies(looper, [req])

"""Check that get_validator_info command works for NETWORK_MONITOR role"""
sdk_get_validator_info(looper, (sdk_wallet_handle, new_network_monitor_did), sdk_pool_handle)

"""Blacklisting network_monitor by new steward"""
op = {'type': '1',
'dest': new_network_monitor_did,
'role': None}
if with_verkey:
op['verkey'] = new_network_monitor_verkey
"""Blacklisting network_monitor by new steward"""
req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, new_steward_did), op)
if with_verkey:
with pytest.raises(RequestRejectedException):
Expand All @@ -54,19 +58,21 @@ def test_network_monitor_suspension_by_itself(looper,
with_verkey):
new_network_monitor_did, new_network_monitor_verkey = looper.loop.run_until_complete(
did.create_and_store_my_did(sdk_wallet_steward[0], "{}"))

"""Adding NETWORK_MONITOR role by steward"""
op = {'type': '1',
'dest': new_network_monitor_did,
'role': NETWORK_MONITOR,
'verkey': new_network_monitor_verkey}
req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, sdk_wallet_steward[1]), op)
sdk_get_and_check_replies(looper, [req])

"""Blacklisting network_monitor by itself"""
op = {'type': '1',
'dest': new_network_monitor_did,
'role': None}
if with_verkey:
op['verkey'] = new_network_monitor_verkey
"""Blacklisting network_monitor by itself"""
req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, new_network_monitor_did), op)
with pytest.raises(RequestRejectedException):
sdk_get_and_check_replies(looper, [req])
13 changes: 9 additions & 4 deletions indy_node/test/nym_txn/test_nym_blacklisting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ def test_steward_suspension_by_another_trustee(looper,
did.create_and_store_my_did(sdk_wallet_trustee[0], "{}"))
new_steward_did, new_steward_verkey = looper.loop.run_until_complete(
did.create_and_store_my_did(sdk_wallet_trustee[0], "{}"))

"""Adding new steward"""
sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee, 'newSteward', STEWARD_STRING, verkey=new_steward_verkey, dest=new_steward_did)

"""Adding new trustee"""
sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee, 'newTrustee', TRUSTEE_STRING, verkey=new_trustee_verkey, dest=new_trustee_did)

"""Blacklisting new steward by new trustee"""
op = {'type': '1',
'dest': new_steward_did,
'role': None}
if with_verkey:
op['verkey'] = new_steward_verkey
"""Blacklisting new steward by new trustee"""
req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, new_trustee_did), op)
if with_verkey:
with pytest.raises(RequestRejectedException):
Expand All @@ -37,7 +40,7 @@ def test_steward_suspension_by_another_trustee(looper,
sdk_get_and_check_replies(looper, [req])


def test_steward_cannot_work_after_demote(looper,
def test_steward_cannot_create_trust_anchors_after_demote (looper,
sdk_pool_handle,
sdk_wallet_trustee,
sdk_wallet_handle):
Expand All @@ -47,23 +50,25 @@ def test_steward_cannot_work_after_demote(looper,
did.create_and_store_my_did(sdk_wallet_trustee[0], "{}"))
new_ta_2_did, new_ta_2_verkey = looper.loop.run_until_complete(
did.create_and_store_my_did(sdk_wallet_trustee[0], "{}"))

"""Adding new steward"""
sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee,
'newSteward',
STEWARD_STRING,
verkey=new_steward_verkey, dest=new_steward_did)

"""Adding new TA"""
sdk_add_new_nym(looper, sdk_pool_handle,
(sdk_wallet_handle, new_steward_did),
'newSteward',
TRUST_ANCHOR_STRING,
verkey=new_ta_verkey, dest=new_ta_did)
"""Demote new steward"""

"""Blacklisting new steward by trustee"""
op = {'type': '1',
'dest': new_steward_did,
'role': None}
"""Blacklisting new steward by trustee"""
req = sdk_sign_and_submit_op(looper, sdk_pool_handle, sdk_wallet_trustee, op)
sdk_get_and_check_replies(looper, [req])

Expand Down

0 comments on commit 0e7fa92

Please sign in to comment.