def test_network_monitor_suspension_by_another_steward(looper, sdk_pool_handle, sdk_wallet_steward, sdk_wallet_trustee, sdk_wallet_handle, with_verkey): new_steward_did, new_steward_verkey = looper.loop.run_until_complete( 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 req = sdk_sign_and_submit_op(looper, sdk_pool_handle, (sdk_wallet_handle, new_steward_did), op) if with_verkey: with pytest.raises(RequestRejectedException): sdk_get_and_check_replies(looper, [req]) else: sdk_get_and_check_replies(looper, [req]) with pytest.raises(RequestRejectedException): sdk_get_validator_info( looper, (sdk_wallet_handle, new_network_monitor_did), sdk_pool_handle)
def run(self): # Step 1. Check default auth rule sdk_get_validator_info(self.looper, self.trustee_wallet, self.sdk_pool_handle) with pytest.raises(RequestRejectedException): sdk_get_validator_info(self.looper, self.new_default_wallet, self.sdk_pool_handle) # Step 2. Change auth rule self.send_and_check(self.changed_auth_rule, self.trustee_wallet) # Step 3. Check, that we cannot do txn the old way with pytest.raises(RequestRejectedException): sdk_get_validator_info(self.looper, self.trustee_wallet, self.sdk_pool_handle) # Step 4. Check, that new auth rule is used sdk_get_validator_info(self.looper, self.new_default_wallet, self.sdk_pool_handle) # Step 5. Return default auth rule self.send_and_check(self.default_auth_rule, self.trustee_wallet) # Step 6. Check, that default auth rule works sdk_get_validator_info(self.looper, self.trustee_wallet, self.sdk_pool_handle) with pytest.raises(RequestRejectedException): sdk_get_validator_info(self.looper, self.new_default_wallet, self.sdk_pool_handle)
def test_fail_validator_info_command(sdk_pool_handle, sdk_wallet_client, looper): with pytest.raises(RequestRejectedException) as excinfo: sdk_get_validator_info(looper, sdk_wallet_client, sdk_pool_handle) assert excinfo.match("None role cannot do action with type = " + VALIDATOR_INFO)
def test_validator_info_command(sdk_pool_handle, sdk_wallet_trustee, looper): req, resp = sdk_get_validator_info(looper, sdk_wallet_trustee, sdk_pool_handle) _comparison_reply(resp, req)
def test_fail_validator_info_command(sdk_pool_handle, sdk_wallet_client, looper): with pytest.raises(RequestRejectedException) as excinfo: sdk_get_validator_info(looper, sdk_wallet_client, sdk_pool_handle) assert excinfo.match("There is no accepted constraint")
def test_fail_validator_info_command(sdk_pool_handle, sdk_wallet_client, looper): with pytest.raises(RequestRejectedException) as excinfo: sdk_get_validator_info(looper, sdk_wallet_client, sdk_pool_handle) assert excinfo.match("Rule for this action is")