From fcb6844c70fadbd01f3333b377a3c78747685e76 Mon Sep 17 00:00:00 2001 From: Bassam Date: Tue, 7 May 2024 09:10:47 -0400 Subject: [PATCH] fix: integration test (#1011) Signed-off-by: Bassam Riman Signed-off-by: Yurii Shynbuiev - IOHK Co-authored-by: Yurii Shynbuiev - IOHK Signed-off-by: Pat Losoponkul --- tests/integration-tests/build.gradle.kts | 4 +- .../test/kotlin/abilities/ListenToEvents.kt | 4 +- .../test/kotlin/common/CredentialSchema.kt | 2 +- .../src/test/kotlin/steps/Setup.kt | 4 +- .../test/kotlin/steps/common/CommonSteps.kt | 8 +- .../steps/connection/ConnectionSteps.kt | 6 +- .../credentials/IssueCredentialsSteps.kt | 2 +- .../kotlin/steps/did/DeactivateDidSteps.kt | 4 +- .../test/kotlin/steps/did/ManageDidSteps.kt | 6 +- .../test/kotlin/steps/did/PublishDidSteps.kt | 2 +- .../test/kotlin/steps/did/UpdateDidSteps.kt | 6 +- .../kotlin/steps/multitenancy/EntitySteps.kt | 6 +- .../kotlin/steps/multitenancy/EventsSteps.kt | 2 +- .../kotlin/steps/multitenancy/WalletsSteps.kt | 6 +- .../proofs/AnoncredsPresentProofSteps.kt | 2 +- .../kotlin/steps/proofs/PresentProofSteps.kt | 2 +- .../steps/schemas/CredentialSchemasSteps.kt | 4 +- .../test/kotlin/steps/system/SystemSteps.kt | 2 +- .../steps/verification/VcVerificationSteps.kt | 90 +++++++++++++------ .../VerificationPoliciesSteps.kt | 4 +- .../verification/vc_verification.feature | 5 ++ 21 files changed, 103 insertions(+), 68 deletions(-) create mode 100644 tests/integration-tests/src/test/resources/features/verification/vc_verification.feature diff --git a/tests/integration-tests/build.gradle.kts b/tests/integration-tests/build.gradle.kts index f9a96b0d99..b9d606a6e1 100644 --- a/tests/integration-tests/build.gradle.kts +++ b/tests/integration-tests/build.gradle.kts @@ -33,9 +33,9 @@ dependencies { testImplementation("io.ktor:ktor-server-netty:2.3.0") testImplementation("io.ktor:ktor-client-apache:2.3.0") // RestAPI client - testImplementation("org.hyperledger.identus:cloud-agent-client-kotlin:1.32.0") + testImplementation("org.hyperledger.identus:cloud-agent-client-kotlin:1.32.1") // Test helpers library - testImplementation("io.iohk.atala:atala-automation:0.3.2") + testImplementation("io.iohk.atala:atala-automation:0.4.0") // Hoplite for configuration testImplementation("com.sksamuel.hoplite:hoplite-core:2.7.5") testImplementation("com.sksamuel.hoplite:hoplite-hocon:2.7.5") diff --git a/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt b/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt index 6a360d92f9..2ea3b69724 100644 --- a/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt +++ b/tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt @@ -23,9 +23,7 @@ open class ListenToEvents( ) : Ability, HasTeardown { private val server: ApplicationEngine - private val gson = GsonBuilder() - .registerTypeAdapter(OffsetDateTime::class.java, CustomGsonObjectMapperFactory.OffsetDateTimeDeserializer()) - .create() + private val gson = GsonBuilder().registerTypeAdapter(OffsetDateTime::class.java, CustomGsonObjectMapperFactory.OffsetDateTimeTypeAdapter()).create() var connectionEvents: MutableList = mutableListOf() var credentialEvents: MutableList = mutableListOf() diff --git a/tests/integration-tests/src/test/kotlin/common/CredentialSchema.kt b/tests/integration-tests/src/test/kotlin/common/CredentialSchema.kt index 32990542a7..972f806069 100644 --- a/tests/integration-tests/src/test/kotlin/common/CredentialSchema.kt +++ b/tests/integration-tests/src/test/kotlin/common/CredentialSchema.kt @@ -1,8 +1,8 @@ package common -import org.hyperledger.identus.client.models.CredentialSchemaInput import models.JsonSchema import models.JsonSchemaProperty +import org.hyperledger.identus.client.models.CredentialSchemaInput import java.util.UUID enum class CredentialSchema { diff --git a/tests/integration-tests/src/test/kotlin/steps/Setup.kt b/tests/integration-tests/src/test/kotlin/steps/Setup.kt index dbb134ceb7..ce1034a63e 100644 --- a/tests/integration-tests/src/test/kotlin/steps/Setup.kt +++ b/tests/integration-tests/src/test/kotlin/steps/Setup.kt @@ -8,8 +8,6 @@ import config.AgentRole import config.Config import io.cucumber.java.AfterAll import io.cucumber.java.BeforeAll -import org.hyperledger.identus.client.models.CreateWalletRequest -import org.hyperledger.identus.client.models.CreateWebhookNotification import io.restassured.RestAssured import io.restassured.builder.RequestSpecBuilder import net.serenitybdd.screenplay.Actor @@ -17,6 +15,8 @@ import net.serenitybdd.screenplay.actors.Cast import net.serenitybdd.screenplay.actors.OnStage import net.serenitybdd.screenplay.rest.abilities.CallAnApi import org.apache.http.HttpStatus +import org.hyperledger.identus.client.models.CreateWalletRequest +import org.hyperledger.identus.client.models.CreateWebhookNotification import java.util.UUID object Setup { diff --git a/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt b/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt index 5edf9ebfb8..a4df15c5ed 100644 --- a/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/common/CommonSteps.kt @@ -5,14 +5,14 @@ import io.cucumber.java.ParameterType import io.cucumber.java.en.Given import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.Connection -import org.hyperledger.identus.client.models.ConnectionsPage -import org.hyperledger.identus.client.models.IssueCredentialRecord -import org.hyperledger.identus.client.models.IssueCredentialRecordPage import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import net.serenitybdd.screenplay.actors.OnStage import org.apache.http.HttpStatus +import org.hyperledger.identus.client.models.Connection +import org.hyperledger.identus.client.models.ConnectionsPage +import org.hyperledger.identus.client.models.IssueCredentialRecord +import org.hyperledger.identus.client.models.IssueCredentialRecordPage import steps.connection.ConnectionSteps import steps.credentials.IssueCredentialsSteps import steps.did.PublishDidSteps diff --git a/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt b/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt index 230b9336cd..38922a021c 100644 --- a/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/connection/ConnectionSteps.kt @@ -8,14 +8,14 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.AcceptConnectionInvitationRequest -import org.hyperledger.identus.client.models.Connection -import org.hyperledger.identus.client.models.CreateConnectionRequest import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus.SC_CREATED import org.apache.http.HttpStatus.SC_OK import org.assertj.core.api.Assertions.assertThat +import org.hyperledger.identus.client.models.AcceptConnectionInvitationRequest +import org.hyperledger.identus.client.models.Connection +import org.hyperledger.identus.client.models.CreateConnectionRequest class ConnectionSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/credentials/IssueCredentialsSteps.kt b/tests/integration-tests/src/test/kotlin/steps/credentials/IssueCredentialsSteps.kt index 0ec5abd3d0..578ce9419d 100644 --- a/tests/integration-tests/src/test/kotlin/steps/credentials/IssueCredentialsSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/credentials/IssueCredentialsSteps.kt @@ -8,13 +8,13 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.* import models.AnoncredsSchema import models.CredentialEvent import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import net.serenitybdd.screenplay.rest.abilities.CallAnApi import org.apache.http.HttpStatus.* +import org.hyperledger.identus.client.models.* import java.util.UUID class IssueCredentialsSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/did/DeactivateDidSteps.kt b/tests/integration-tests/src/test/kotlin/steps/did/DeactivateDidSteps.kt index d634bcca48..b95a9f3233 100644 --- a/tests/integration-tests/src/test/kotlin/steps/did/DeactivateDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/did/DeactivateDidSteps.kt @@ -8,11 +8,11 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.DIDOperationResponse -import org.hyperledger.identus.client.models.DIDResolutionResult import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus +import org.hyperledger.identus.client.models.DIDOperationResponse +import org.hyperledger.identus.client.models.DIDResolutionResult class DeactivateDidSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/did/ManageDidSteps.kt b/tests/integration-tests/src/test/kotlin/steps/did/ManageDidSteps.kt index 06c112df51..df87418e20 100644 --- a/tests/integration-tests/src/test/kotlin/steps/did/ManageDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/did/ManageDidSteps.kt @@ -7,6 +7,9 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure +import net.serenitybdd.rest.SerenityRest +import net.serenitybdd.screenplay.Actor +import org.apache.http.HttpStatus.SC_CREATED import org.hyperledger.identus.client.models.CreateManagedDidRequest import org.hyperledger.identus.client.models.CreateManagedDidRequestDocumentTemplate import org.hyperledger.identus.client.models.Json @@ -15,9 +18,6 @@ import org.hyperledger.identus.client.models.ManagedDIDKeyTemplate import org.hyperledger.identus.client.models.ManagedDIDPage import org.hyperledger.identus.client.models.Purpose import org.hyperledger.identus.client.models.Service -import net.serenitybdd.rest.SerenityRest -import net.serenitybdd.screenplay.Actor -import org.apache.http.HttpStatus.SC_CREATED class ManageDidSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/did/PublishDidSteps.kt b/tests/integration-tests/src/test/kotlin/steps/did/PublishDidSteps.kt index d3328c85c7..cd04a6e14f 100644 --- a/tests/integration-tests/src/test/kotlin/steps/did/PublishDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/did/PublishDidSteps.kt @@ -10,12 +10,12 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.* import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus import org.apache.http.HttpStatus.SC_CREATED import org.apache.http.HttpStatus.SC_OK +import org.hyperledger.identus.client.models.* class PublishDidSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/did/UpdateDidSteps.kt b/tests/integration-tests/src/test/kotlin/steps/did/UpdateDidSteps.kt index f641b56086..0f4517d15d 100644 --- a/tests/integration-tests/src/test/kotlin/steps/did/UpdateDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/did/UpdateDidSteps.kt @@ -8,6 +8,9 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure +import net.serenitybdd.rest.SerenityRest +import net.serenitybdd.screenplay.Actor +import org.apache.http.HttpStatus import org.hyperledger.identus.client.models.ActionType import org.hyperledger.identus.client.models.DIDOperationResponse import org.hyperledger.identus.client.models.DIDResolutionResult @@ -19,9 +22,6 @@ import org.hyperledger.identus.client.models.Service import org.hyperledger.identus.client.models.UpdateManagedDIDRequest import org.hyperledger.identus.client.models.UpdateManagedDIDRequestAction import org.hyperledger.identus.client.models.UpdateManagedDIDServiceAction -import net.serenitybdd.rest.SerenityRest -import net.serenitybdd.screenplay.Actor -import org.apache.http.HttpStatus class UpdateDidSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/multitenancy/EntitySteps.kt b/tests/integration-tests/src/test/kotlin/steps/multitenancy/EntitySteps.kt index 1672643016..3bd9c51839 100644 --- a/tests/integration-tests/src/test/kotlin/steps/multitenancy/EntitySteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/multitenancy/EntitySteps.kt @@ -3,12 +3,12 @@ package steps.multitenancy import interactions.Post import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.ApiKeyAuthenticationRequest -import org.hyperledger.identus.client.models.CreateEntityRequest -import org.hyperledger.identus.client.models.EntityResponse import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus.SC_CREATED +import org.hyperledger.identus.client.models.ApiKeyAuthenticationRequest +import org.hyperledger.identus.client.models.CreateEntityRequest +import org.hyperledger.identus.client.models.EntityResponse import java.util.* class EntitySteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/multitenancy/EventsSteps.kt b/tests/integration-tests/src/test/kotlin/steps/multitenancy/EventsSteps.kt index 3e0ba085de..34a89407ee 100644 --- a/tests/integration-tests/src/test/kotlin/steps/multitenancy/EventsSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/multitenancy/EventsSteps.kt @@ -2,9 +2,9 @@ package steps.multitenancy import interactions.Post import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.CreateWebhookNotification import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus +import org.hyperledger.identus.client.models.CreateWebhookNotification class EventsSteps { fun registerNewWebhook(actor: Actor, webhookUrl: String) { diff --git a/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt b/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt index cfed7d7db7..62cf9781c9 100644 --- a/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/multitenancy/WalletsSteps.kt @@ -8,12 +8,12 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.CreateWalletRequest -import org.hyperledger.identus.client.models.WalletDetail -import org.hyperledger.identus.client.models.WalletDetailPage import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus.* +import org.hyperledger.identus.client.models.CreateWalletRequest +import org.hyperledger.identus.client.models.WalletDetail +import org.hyperledger.identus.client.models.WalletDetailPage import java.util.* import kotlin.random.Random diff --git a/tests/integration-tests/src/test/kotlin/steps/proofs/AnoncredsPresentProofSteps.kt b/tests/integration-tests/src/test/kotlin/steps/proofs/AnoncredsPresentProofSteps.kt index ced971f571..566d2f1864 100644 --- a/tests/integration-tests/src/test/kotlin/steps/proofs/AnoncredsPresentProofSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/proofs/AnoncredsPresentProofSteps.kt @@ -7,12 +7,12 @@ import interactions.Post import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.* import models.PresentationEvent import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import net.serenitybdd.screenplay.rest.abilities.CallAnApi import org.apache.http.HttpStatus.SC_CREATED +import org.hyperledger.identus.client.models.* class AnoncredsPresentProofSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/proofs/PresentProofSteps.kt b/tests/integration-tests/src/test/kotlin/steps/proofs/PresentProofSteps.kt index 1700c6e75b..741ef0e9b6 100644 --- a/tests/integration-tests/src/test/kotlin/steps/proofs/PresentProofSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/proofs/PresentProofSteps.kt @@ -8,11 +8,11 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.* import models.PresentationEvent import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus.SC_CREATED +import org.hyperledger.identus.client.models.* class PresentProofSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt b/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt index 4f908a9dc5..3fecf2e436 100644 --- a/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/schemas/CredentialSchemasSteps.kt @@ -11,12 +11,12 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.CredentialSchemaInput -import org.hyperledger.identus.client.models.CredentialSchemaResponse import models.JsonSchema import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus.* +import org.hyperledger.identus.client.models.CredentialSchemaInput +import org.hyperledger.identus.client.models.CredentialSchemaResponse import java.util.UUID class CredentialSchemasSteps { diff --git a/tests/integration-tests/src/test/kotlin/steps/system/SystemSteps.kt b/tests/integration-tests/src/test/kotlin/steps/system/SystemSteps.kt index 91312d5527..b9bfada0d2 100644 --- a/tests/integration-tests/src/test/kotlin/steps/system/SystemSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/system/SystemSteps.kt @@ -5,10 +5,10 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.HealthInfo import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus +import org.hyperledger.identus.client.models.HealthInfo class SystemSteps { @When("{actor} makes a request to the health endpoint") diff --git a/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt b/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt index 9e0d2f8037..fa3addf6ef 100644 --- a/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/verification/VcVerificationSteps.kt @@ -1,13 +1,14 @@ package steps.verification -import interactions.Post +import com.google.gson.Gson import io.cucumber.java.en.When -import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.* +import io.restassured.http.Header import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor +import net.serenitybdd.screenplay.rest.interactions.Post import org.apache.http.HttpStatus.SC_OK +import org.hyperledger.identus.client.models.* import java.time.OffsetDateTime class VcVerificationSteps { @@ -15,60 +16,91 @@ class VcVerificationSteps { @When("{actor} verifies VcVerificationRequest") fun agentVerifiesVerifiableCredential(actor: Actor) { val signedJwtCredential = - "eyJhbGciOiJFUzI1NksifQ.eyJhdWQiOiJkaWQ6cHJpc206dmVyaWZpZXIiLCJuYmYiOjEyNjIzMDQwMDAsImlzcyI6ImRpZDpwcmlzbTo3NzYxMjBlZWIxMjhjZTdkZmQ5NDUwZmZhMTg4MWU5OTYxOWFhMGM5MDRiMDBjODJiYjE3YjU2ODE3Y2IwMmFlIiwiZXhwIjoxMjYzMjU0NDAwLCJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL2V4YW1wbGVzL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJVbml2ZXJzaXR5RGVncmVlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU2NoZW1hIjp7ImlkIjoiZGlkOndvcms6TURQOEFzRmhIemh3VXZHTnVZa1g3VDtpZD0wNmUxMjZkMS1mYTQ0LTQ4ODItYTI0My0xZTMyNmZiZTIxZGI7dmVyc2lvbj0xLjAiLCJ0eXBlIjoiSnNvblNjaGVtYVZhbGlkYXRvcjIwMTgifSwiY3JlZGVudGlhbFN1YmplY3QiOnsidXNlck5hbWUiOiJCb2IiLCJhZ2UiOjQyLCJlbWFpbCI6ImVtYWlsIn0sImNyZWRlbnRpYWxTdGF0dXMiOnsiaWQiOiJkaWQ6d29yazpNRFA4QXNGaEh6aHdVdkdOdVlrWDdUO2lkPTA2ZTEyNmQxLWZhNDQtNDg4Mi1hMjQzLTFlMzI2ZmJlMjFkYjt2ZXJzaW9uPTEuMCIsInR5cGUiOiJTdGF0dXNMaXN0MjAyMUVudHJ5Iiwic3RhdHVzUHVycG9zZSI6IlJldm9jYXRpb24iLCJzdGF0dXNMaXN0SW5kZXgiOjAsInN0YXR1c0xpc3RDcmVkZW50aWFsIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9jcmVkZW50aWFscy9zdGF0dXMvMyJ9LCJyZWZyZXNoU2VydmljZSI6eyJpZCI6Imh0dHBzOi8vZXhhbXBsZS5lZHUvcmVmcmVzaC8zNzMyIiwidHlwZSI6Ik1hbnVhbFJlZnJlc2hTZXJ2aWNlMjAxOCJ9fSwianRpIjoiaHR0cDovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIifQ.JCHIAQdjmOxOdZ1SIf5Nd8FObiARXT6cDcGM3UyQ961Kv4Rb3ZtgpNM-cf2aj5ZFyFko-t7uCsSvrVrYKUYcWg" + "eyJhbGciOiJFUzI1NksifQ.eyJpc3MiOiJkaWQ6cHJpc206NDE1ODg1OGI1ZjBkYWMyZTUwNDdmMjI4NTk4OWVlMzlhNTNkZWJhNzY0NjFjN2FmMDM5NjU0ZGYzYjU5MjI1YyIsImF1ZCI6ImRpZDpwcmlzbTp2ZXJpZmllciIsIm5iZiI6MTI2MjMwNDAwMCwiZXhwIjoxMjYzMjU0NDAwLCJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL2V4YW1wbGVzL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJVbml2ZXJzaXR5RGVncmVlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU2NoZW1hIjp7ImlkIjoiZGlkOndvcms6TURQOEFzRmhIemh3VXZHTnVZa1g3VDtpZD0wNmUxMjZkMS1mYTQ0LTQ4ODItYTI0My0xZTMyNmZiZTIxZGI7dmVyc2lvbj0xLjAiLCJ0eXBlIjoiSnNvblNjaGVtYVZhbGlkYXRvcjIwMTgifSwiY3JlZGVudGlhbFN1YmplY3QiOnsidXNlck5hbWUiOiJCb2IiLCJhZ2UiOjQyLCJlbWFpbCI6ImVtYWlsIn0sImNyZWRlbnRpYWxTdGF0dXMiOnsiaWQiOiJkaWQ6d29yazpNRFA4QXNGaEh6aHdVdkdOdVlrWDdUO2lkPTA2ZTEyNmQxLWZhNDQtNDg4Mi1hMjQzLTFlMzI2ZmJlMjFkYjt2ZXJzaW9uPTEuMCIsInR5cGUiOiJTdGF0dXNMaXN0MjAyMUVudHJ5Iiwic3RhdHVzUHVycG9zZSI6IlJldm9jYXRpb24iLCJzdGF0dXNMaXN0SW5kZXgiOjAsInN0YXR1c0xpc3RDcmVkZW50aWFsIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9jcmVkZW50aWFscy9zdGF0dXMvMyJ9LCJyZWZyZXNoU2VydmljZSI6eyJpZCI6Imh0dHBzOi8vZXhhbXBsZS5lZHUvcmVmcmVzaC8zNzMyIiwidHlwZSI6Ik1hbnVhbFJlZnJlc2hTZXJ2aWNlMjAxOCJ9fSwianRpIjoiaHR0cDovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIifQ.HBxrn8Nu6y1RvUAU8XcwUDPOiiHhC1OgHN757lWai6i8P-pHL4TBzIDartYtrMiZUKpNx9Onb19sJYywtqFkpg" + val request = - listOf( + arrayOf( VcVerificationRequest( signedJwtCredential, listOf( - ParameterizableVcVerification(VcVerification.SIGNATURE_VERIFICATION), ParameterizableVcVerification( VcVerification.NOT_BEFORE_CHECK, - DateTimeParameter(OffsetDateTime.now()) as VcVerificationParameter, + DateTimeParameter(dateTime = OffsetDateTime.parse("2010-01-01T00:00:00Z")), ), ParameterizableVcVerification( VcVerification.EXPIRATION_CHECK, - DateTimeParameter(OffsetDateTime.now()) as VcVerificationParameter, + DateTimeParameter(dateTime = OffsetDateTime.parse("2010-01-01T00:00:00Z")), + ), + ParameterizableVcVerification( + VcVerification.AUDIENCE_CHECK, + DidParameter(did = "did:prism:verifier"), + ), + ParameterizableVcVerification( + VcVerification.ISSUER_IDENTIFICATION, + DidParameter(did = "did:prism:4158858b5f0dac2e5047f2285989ee39a53deba76461c7af039654df3b59225c"), ), ), ), VcVerificationRequest( signedJwtCredential, listOf( + ParameterizableVcVerification( + VcVerification.EXPIRATION_CHECK, + DateTimeParameter(dateTime = OffsetDateTime.parse("2010-01-13T00:00:00Z")), + ), + ParameterizableVcVerification( + VcVerification.NOT_BEFORE_CHECK, + DateTimeParameter(dateTime = OffsetDateTime.parse("2009-01-01T00:00:00Z")), + ), ParameterizableVcVerification( VcVerification.AUDIENCE_CHECK, - DidParameter("did:prism:verifier") as VcVerificationParameter, + DidParameter(did = "BAD AUDIENCE"), + ), + ParameterizableVcVerification( + VcVerification.ISSUER_IDENTIFICATION, + DidParameter(did = "BAD ISSUER"), ), ), ), ) - actor.attemptsTo( + + val post = Post.to("/verification/credential").with { + it.header(Header("apiKey", "pylnapbvyudwmfrt")) it.body(request) - }, - ) - val vcVerificationResponses = SerenityRest.lastResponse().get>() + } actor.attemptsTo( - Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), - Ensure.that(vcVerificationResponses).containsExactlyInAnyOrderElementsFrom( + post, + ) + + val expected = listOf( + VcVerificationResponse( + signedJwtCredential, listOf( - VcVerificationResponse( - signedJwtCredential, - listOf( - VcVerificationResult(VcVerification.SIGNATURE_VERIFICATION, false), - VcVerificationResult(VcVerification.NOT_BEFORE_CHECK, true), - VcVerificationResult(VcVerification.EXPIRATION_CHECK, true), - ), - ), - VcVerificationResponse( - signedJwtCredential, - listOf( - VcVerificationResult(VcVerification.AUDIENCE_CHECK, true), - ), - ), + VcVerificationResult(VcVerification.NOT_BEFORE_CHECK, true), + VcVerificationResult(VcVerification.EXPIRATION_CHECK, true), + VcVerificationResult(VcVerification.AUDIENCE_CHECK, true), + VcVerificationResult(VcVerification.ISSUER_IDENTIFICATION, true), + ), + ), + VcVerificationResponse( + signedJwtCredential, + listOf( + VcVerificationResult(VcVerification.EXPIRATION_CHECK, false), + VcVerificationResult(VcVerification.NOT_BEFORE_CHECK, false), + VcVerificationResult(VcVerification.AUDIENCE_CHECK, false), + VcVerificationResult(VcVerification.ISSUER_IDENTIFICATION, false), ), ), ) + actor.attemptsTo( + Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), + Ensure.that( + SerenityRest.lastResponse().body().asString(), + ).isEqualTo( + Gson().toJson(expected), + ), + ) } } diff --git a/tests/integration-tests/src/test/kotlin/steps/verificationpolicies/VerificationPoliciesSteps.kt b/tests/integration-tests/src/test/kotlin/steps/verificationpolicies/VerificationPoliciesSteps.kt index f300f47ed7..ca6a4cf8ca 100644 --- a/tests/integration-tests/src/test/kotlin/steps/verificationpolicies/VerificationPoliciesSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/verificationpolicies/VerificationPoliciesSteps.kt @@ -8,11 +8,11 @@ import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure -import org.hyperledger.identus.client.models.VerificationPolicyInput -import org.hyperledger.identus.client.models.VerificationPolicyResponse import net.serenitybdd.rest.SerenityRest import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus +import org.hyperledger.identus.client.models.VerificationPolicyInput +import org.hyperledger.identus.client.models.VerificationPolicyResponse import java.util.* class VerificationPoliciesSteps { diff --git a/tests/integration-tests/src/test/resources/features/verification/vc_verification.feature b/tests/integration-tests/src/test/resources/features/verification/vc_verification.feature new file mode 100644 index 0000000000..ed12bf50f2 --- /dev/null +++ b/tests/integration-tests/src/test/resources/features/verification/vc_verification.feature @@ -0,0 +1,5 @@ +Feature: Vc Verification schemas + +Scenario: Successful Verifies VcVerificationRequest + Given Issuer and Holder have an existing connection + When Issuer verifies VcVerificationRequest