message: Added couple of tests for nym request
diff: @@ -53,3 +53,34 @@ async def test_build_nym_request_works_with_option_fields():
  response = json.loads(await ledger.build_nym_request(identifier, destination, ver_key, alias, role))
  assert expected_response.items() <= response.items()
  +
  +
  +@pytest.mark.asyncio
  +async def test_nym_request_works_for_different_roles(wallet_handle, pool_handle, identity_trustee1):
  + (trustee_did, _) = identity_trustee1
  +
  + await check_for_role(pool_handle, wallet_handle, trustee_did, 'TRUST_ANCHOR', '101')
  + await check_for_role(pool_handle, wallet_handle, trustee_did, 'TRUSTEE', '0')
  + await check_for_role(pool_handle, wallet_handle, trustee_did, 'STEWARD', '2')
  +
  +
  +@pytest.mark.asyncio
  +async def check_for_role(pool_handle, wallet_handle, trustee_did, role, expected_role_value):
  + (my_did, my_verkey, _) = await signus.create_and_store_my_did(wallet_handle, "{}")
  +
  + nym_request = await ledger.build_nym_request(trustee_did, my_did, my_verkey, None, role)
  + await ledger.sign_and_submit_request(pool_handle, wallet_handle, trustee_did, nym_request)
  +
  + get_nym_request = await ledger.build_get_nym_request(my_did, my_did)
  + get_nym_response = json.loads(await ledger.submit_request(pool_handle, get_nym_request))
  + assert expected_role_value == json.loads(get_nym_response['result']['data'])['role']
  +
  +
  +@pytest.mark.asyncio
  +async def test_nym_request_works_for_invalid_role(identity_trustee1, identity_my1):
  + (trustee_did, _) = identity_trustee1
  + (my_did, _) = identity_my1
  +
  + with pytest.raises(IndyError) as e:
  + await ledger.build_nym_request(trustee_did, my_did, None, None, "WRONG_ROLE")
  + assert ErrorCode.CommonInvalidStructure == e.value.error_code
  