From 15a619c58936815072191b218ae2076acd11e50f Mon Sep 17 00:00:00 2001 From: Tudor Voicu Date: Thu, 14 Oct 2021 14:21:18 +0200 Subject: [PATCH] Addressed Pawel's review comments --- .../auth/AuthorizationInterceptorSpec.scala | 23 +++++++++---------- .../ledger/api/auth/AuthorizerSpec.scala | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizationInterceptorSpec.scala b/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizationInterceptorSpec.scala index 9446c75b184a..b70c7c6038ad 100644 --- a/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizationInterceptorSpec.scala +++ b/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizationInterceptorSpec.scala @@ -27,23 +27,22 @@ class AuthorizationInterceptorSpec behavior of s"$className.interceptCall" it should "close the ServerCall with a V1 status code on decoding failure" in { - testServerCloseError(usesSelfServiceErrorCodes = false) { case (status, metadata) => - status.getCode shouldBe Status.Code.INTERNAL - status.getDescription shouldBe "Failed to get claims from request metadata" - metadata.keys() shouldBe empty + testServerCloseError(usesSelfServiceErrorCodes = false) { case (actualStatus, actualMetadata) => + actualStatus.getCode shouldBe Status.Code.INTERNAL + actualStatus.getDescription shouldBe "Failed to get claims from request metadata" + actualMetadata.keys() shouldBe empty } } it should "close the ServerCall with a V2 status code on decoding failure" in { - testServerCloseError(usesSelfServiceErrorCodes = true) { - case (actualStatus: Status, actualTrailers) => - actualStatus.getCode shouldBe Status.Code.INTERNAL - actualStatus.getDescription shouldBe "An error occurred. Please contact the operator and inquire about the request " + testServerCloseError(usesSelfServiceErrorCodes = true) { case (actualStatus, actualMetadata) => + actualStatus.getCode shouldBe Status.Code.INTERNAL + actualStatus.getDescription shouldBe "An error occurred. Please contact the operator and inquire about the request " - val actualRpcStatus = StatusProto.fromStatusAndTrailers(actualStatus, actualTrailers) - actualRpcStatus.getDetailsList.size() shouldBe 1 - val errorInfo = actualRpcStatus.getDetailsList.get(0).unpack(classOf[ErrorInfo]) - errorInfo.getReason shouldBe "INTERNAL_AUTHORIZATION_ERROR" + val actualRpcStatus = StatusProto.fromStatusAndTrailers(actualStatus, actualMetadata) + actualRpcStatus.getDetailsList.size() shouldBe 1 + val errorInfo = actualRpcStatus.getDetailsList.get(0).unpack(classOf[ErrorInfo]) + errorInfo.getReason shouldBe "INTERNAL_AUTHORIZATION_ERROR" } } diff --git a/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizerSpec.scala b/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizerSpec.scala index a6487bdeacd2..68dd67de04ee 100644 --- a/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizerSpec.scala +++ b/ledger/ledger-api-auth/src/test/suite/scala/com/digitalasset/ledger/api/auth/AuthorizerSpec.scala @@ -17,7 +17,7 @@ import scala.util.{Failure, Success, Try} class AuthorizerSpec extends AsyncFlatSpec with Matchers { private val className = classOf[Authorizer].getSimpleName private val dummyRequest = 1337L - private val expectedSuccessfulResponse = "leet" + private val expectedSuccessfulResponse = "expectedSuccessfulResponse" private val dummyReqRes: Long => Future[String] = Map(dummyRequest -> Future.successful(expectedSuccessfulResponse)) private val allAuthorized: ClaimSet.Claims => Either[AuthorizationError, Unit] = _ => Right(())