forked from hyperledger/indy-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INDY-1069: move state-depended checks from static to dynamic validati…
…on. (hyperledger#531) * INDY-1069: move state-depended checks from static to dynamic validation. Signed-off-by: Sergey Shilov <[email protected]> * Add test that emulates NYM resend. Signed-off-by: Sergey Shilov <[email protected]> * Fix testTrusteeSuspendingTrustee test. Signed-off-by: Sergey Shilov <[email protected]> * Move resend NYM test into separate file. Signed-off-by: Sergey Shilov <[email protected]> * Remove duplicated authorised check. Signed-off-by: Sergey Shilov <[email protected]> * Fix flake8 warning. Signed-off-by: Sergey Shilov <[email protected]> * Get back checking for owner or trustee for existing NYM. Also implement corresponding test. Signed-off-by: Sergey Shilov <[email protected]> * Fix flake8 warning. Signed-off-by: Sergey Shilov <[email protected]> * Fix testTrusteeSuspensionByTrustee test. Signed-off-by: Sergey Shilov <[email protected]> * Add ugly hack in test_nym_send_twice() test to deal with old libindy. Signed-off-by: Sergey Shilov <[email protected]>
- Loading branch information
1 parent
ecde3c0
commit ac1cd2d
Showing
6 changed files
with
83 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import json | ||
|
||
from indy_client.test.cli.helper import createHalfKeyIdentifierAndAbbrevVerkey | ||
from indy.ledger import sign_request, submit_request, build_nym_request | ||
from indy.error import IndyError, ErrorCode | ||
from plenum.common.constants import REPLY, REJECT | ||
|
||
|
||
def test_nym_send_twice(looper, sdk_pool_handle, sdk_wallet_steward): | ||
idr, verkey = createHalfKeyIdentifierAndAbbrevVerkey() | ||
|
||
wallet_handle, identifier = sdk_wallet_steward | ||
|
||
for i in range(2): | ||
request = looper.loop.run_until_complete(build_nym_request(identifier, idr, verkey, None, None)) | ||
req_signed = looper.loop.run_until_complete(sign_request(wallet_handle, identifier, request)) | ||
|
||
if i == 0: | ||
result = json.loads(looper.loop.run_until_complete(submit_request(sdk_pool_handle, req_signed))) | ||
assert result['op'] == REPLY | ||
else: | ||
# TODO(INDY-1069): Ugly hack to deal with old libindy which raises exception on REJECT, | ||
# in fact it should be simple: | ||
# assert result['op'] == REJECT | ||
try: | ||
json.loads(looper.loop.run_until_complete(submit_request(sdk_pool_handle, req_signed))) | ||
assert False | ||
except IndyError as ex: | ||
assert ex.error_code == ErrorCode.LedgerInvalidTransaction | ||
|
||
def test_nym_resend(looper, sdk_pool_handle, sdk_wallet_steward): | ||
idr, verkey = createHalfKeyIdentifierAndAbbrevVerkey() | ||
|
||
wallet_handle, identifier = sdk_wallet_steward | ||
|
||
request = looper.loop.run_until_complete(build_nym_request(identifier, idr, verkey, None, None)) | ||
req_signed = looper.loop.run_until_complete(sign_request(wallet_handle, identifier, request)) | ||
|
||
for i in range(2): | ||
result = json.loads(looper.loop.run_until_complete(submit_request(sdk_pool_handle, req_signed))) | ||
assert result['op'] == REPLY |