Skip to content

Commit

Permalink
[INDY-1963] Fix error string checking in tests
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 30, 2019
1 parent 6130b5b commit 636b4be
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ def test_only_trustee_send_pool_config_writes_true_force_false(
sdk_wallet_steward = sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee, 'tmpname', STEWARD_STRING)
req = sdk_pool_config_sent(looper, sdk_pool_handle, sdk_wallet_steward, poolConfigWTFF)
sdk_get_bad_response(looper, [req], RequestRejectedException, 'role is not accepted')
sdk_get_bad_response(looper, [req], RequestRejectedException, '{} can not do this action'.format(STEWARD_STRING))


def test_only_trustee_send_pool_config_writes_false_force_false(
nodeSet, looper, sdk_pool_handle, sdk_wallet_trustee, poolConfigWFFF):
sdk_wallet_steward = sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee, 'tmpname', STEWARD_STRING)
req = sdk_pool_config_sent(looper, sdk_pool_handle, sdk_wallet_steward, poolConfigWFFF)
sdk_get_bad_response(looper, [req], RequestRejectedException, 'role is not accepted')
sdk_get_bad_response(looper, [req], RequestRejectedException, '{} can not do this action'.format(STEWARD_STRING))


def test_only_trustee_send_pool_config_writes_true_force_true(
nodeSet, looper, sdk_pool_handle, sdk_wallet_trustee, poolConfigWTFT):
sdk_wallet_steward = sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee, 'tmpname', STEWARD_STRING)
req = sdk_pool_config_sent(looper, sdk_pool_handle, sdk_wallet_steward, poolConfigWTFT)
sdk_get_bad_response(looper, [req], RequestNackedException, 'role is not accepted')
sdk_get_bad_response(looper, [req], RequestNackedException, '{} can not do this action'.format(STEWARD_STRING))


def test_only_trustee_send_pool_config_writes_false_force_true(
nodeSet, looper, sdk_pool_handle, sdk_wallet_trustee, poolConfigWFFT):
sdk_wallet_steward = sdk_add_new_nym(looper, sdk_pool_handle,
sdk_wallet_trustee, 'tmpname', STEWARD_STRING)
req = sdk_pool_config_sent(looper, sdk_pool_handle, sdk_wallet_steward, poolConfigWFFT)
sdk_get_bad_response(looper, [req], RequestNackedException, 'role is not accepted')
sdk_get_bad_response(looper, [req], RequestNackedException, '{} can not do this action'.format(STEWARD_STRING))
4 changes: 2 additions & 2 deletions indy_node/test/pool_restart/test_fail_pool_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RequestNackedException

from indy_common.constants import POOL_RESTART, ACTION, START, DATETIME
from plenum.common.constants import TXN_TYPE
from plenum.common.constants import TXN_TYPE, STEWARD_STRING
from plenum.test.helper import sdk_gen_request, sdk_sign_and_submit_req_obj, \
sdk_get_reply, sdk_get_and_check_replies

Expand All @@ -22,7 +22,7 @@ def test_fail_pool_restart_with_steward_role(
req_obj)
with pytest.raises(RequestRejectedException) as excinfo:
sdk_get_and_check_replies(looper, [req], 100)
assert excinfo.match("role is not accepted")
assert excinfo.match('{} can not do this action'.format(STEWARD_STRING))


def test_fail_pool_restart_with_invalid_datetime(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_fail_validator_info_command(
sdk_get_validator_info(looper,
sdk_wallet_client,
sdk_pool_handle)
assert excinfo.match("There is no accepted constraint")
assert excinfo.match("Rule for this action is")


def _comparison_reply(responses, req_obj):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_client_cant_send_nym(looper,
# client cant create another client NYM when ANYONE_CAN_WRITE set to False
with pytest.raises(RequestRejectedException) as e:
sdk_add_new_nym(looper, sdk_pool_handle, sdk_wallet_client)
e.match('There is no accepted constraint')
e.match('Rule for this action is')


def test_client_can_send_attrib(looper,
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_client_cant_send_schema(looper,
issuer_create_schema(identifier, "another_name", "2.0", json.dumps(["first", "last"])))
request = looper.loop.run_until_complete(build_schema_request(identifier, schema_json))
sdk_get_bad_response(looper, [sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_client, request)],
RequestRejectedException, 'There is no accepted constraint')
RequestRejectedException, 'Rule for this action is')


def test_client_cant_send_claim_def(looper,
Expand All @@ -96,4 +96,4 @@ def test_client_cant_send_claim_def(looper,
# Client cant send create if ANYONE_CAN_WRITE flag set to True
req = sdk_sign_request_from_dict(looper, sdk_wallet_client, claim_def)
req = sdk_send_signed_requests(sdk_pool_handle, [json.dumps(req)])
sdk_get_bad_response(looper, req, RequestRejectedException, 'There is no accepted constraint')
sdk_get_bad_response(looper, req, RequestRejectedException, 'Rule for this action is')

0 comments on commit 636b4be

Please sign in to comment.