From ac3e6a1a9305f023c37e0a17517be827e5f6194a Mon Sep 17 00:00:00 2001 From: Allain Magyar Date: Mon, 29 Jul 2024 11:18:21 -0300 Subject: [PATCH] test: fix credential type on presentation Signed-off-by: Allain Magyar --- .../identus/walletsdk/workflow/EdgeAgentWorkflow.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/end-to-end/src/test/kotlin/org/hyperledger/identus/walletsdk/workflow/EdgeAgentWorkflow.kt b/tests/end-to-end/src/test/kotlin/org/hyperledger/identus/walletsdk/workflow/EdgeAgentWorkflow.kt index 477191d99..67daf4a2c 100644 --- a/tests/end-to-end/src/test/kotlin/org/hyperledger/identus/walletsdk/workflow/EdgeAgentWorkflow.kt +++ b/tests/end-to-end/src/test/kotlin/org/hyperledger/identus/walletsdk/workflow/EdgeAgentWorkflow.kt @@ -3,6 +3,7 @@ package org.hyperledger.identus.walletsdk.workflow import com.google.gson.GsonBuilder import io.iohk.atala.automation.serenity.interactions.PollingWait import io.iohk.atala.automation.utils.Logger +import io.ktor.util.reflect.* import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking import net.serenitybdd.screenplay.Actor @@ -19,12 +20,15 @@ import org.hyperledger.identus.walletsdk.domain.models.CredentialType import org.hyperledger.identus.walletsdk.domain.models.DID import org.hyperledger.identus.walletsdk.domain.models.PolluxError import org.hyperledger.identus.walletsdk.domain.models.PresentationClaims +import org.hyperledger.identus.walletsdk.domain.models.ProvableCredential import org.hyperledger.identus.walletsdk.domain.models.Seed import org.hyperledger.identus.walletsdk.edgeagent.protocols.issueCredential.IssueCredential import org.hyperledger.identus.walletsdk.edgeagent.protocols.issueCredential.OfferCredential import org.hyperledger.identus.walletsdk.edgeagent.protocols.outOfBand.OutOfBandInvitation import org.hyperledger.identus.walletsdk.edgeagent.protocols.proofOfPresentation.RequestPresentation import org.hyperledger.identus.walletsdk.pluto.PlutoBackupTask +import org.hyperledger.identus.walletsdk.pollux.models.AnonCredential +import org.hyperledger.identus.walletsdk.pollux.models.JWTCredential import java.util.UUID import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes @@ -74,9 +78,12 @@ class EdgeAgentWorkflow { UseWalletSdk.execute { val credentials = it.sdk.getAllCredentials().first() val credential = credentials.first() - val requestPresentationMessage = RequestPresentation.fromMessage(it.proofRequestStack.removeFirst()) - val presentation = it.sdk.preparePresentationForRequestProof(requestPresentationMessage, credential) - it.sdk.sendMessage(presentation.makeMessage()) + assertThat(credential).instanceOf(ProvableCredential::class) + if (credential is ProvableCredential) { + val requestPresentationMessage = RequestPresentation.fromMessage(it.proofRequestStack.removeFirst()) + val presentation = it.sdk.preparePresentationForRequestProof(requestPresentationMessage, credential) + it.sdk.sendMessage(presentation.makeMessage()) + } } ) }