Skip to content

Commit

Permalink
test: creates adapter workaround for status
Browse files Browse the repository at this point in the history
Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
  • Loading branch information
amagyar-iohk committed Mar 28, 2024
1 parent 7fb997d commit 28dd981
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
36 changes: 31 additions & 5 deletions tests/integration-tests/src/test/kotlin/models/Events.kt
Expand Up @@ -2,10 +2,7 @@ package models

import com.google.gson.JsonElement
import com.google.gson.annotations.SerializedName
import io.iohk.atala.prism.models.Connection
import io.iohk.atala.prism.models.IssueCredentialRecord
import io.iohk.atala.prism.models.ManagedDID
import io.iohk.atala.prism.models.PresentationStatus
import io.iohk.atala.prism.models.*

data class Event(
@SerializedName("type") var type: String,
Expand Down Expand Up @@ -35,10 +32,39 @@ data class PresentationEvent(
@SerializedName("type") var type: String,
@SerializedName("id") var id: String,
@SerializedName("ts") var ts: String,
@SerializedName("data") var data: PresentationStatus,
@SerializedName("data") var data: PresentationStatusAdapter, // FIXME: rollback to PresentationStatus when Status is fixed
@SerializedName("walletId") var walletId: String,
)

data class PresentationStatusAdapter( // FIXME: delete this class when PresentationStatus.Status is fixed
@SerializedName("presentationId") val presentationId: String,
@SerializedName("thid") val thid: String,
@SerializedName("role") val role: PresentationStatus.Role,
@SerializedName("status") val status: Status,
@SerializedName("metaRetries") val metaRetries: Int,
@SerializedName("proofs") val proofs: List<ProofRequestAux>? = null,
@SerializedName("data") val `data`: List<String>? = null,
@SerializedName("connectionId") val connectionId: String? = null
) {
enum class Status(val value: String) {
@SerializedName(value = "RequestPending") REQUEST_PENDING("RequestPending"),
@SerializedName(value = "RequestSent") REQUEST_SENT("RequestSent"),
@SerializedName(value = "RequestReceived") REQUEST_RECEIVED("RequestReceived"),
@SerializedName(value = "RequestRejected") REQUEST_REJECTED("RequestRejected"),
@SerializedName(value = "PresentationPending") PRESENTATION_PENDING("PresentationPending"),
@SerializedName(value = "PresentationGenerated") PRESENTATION_GENERATED("PresentationGenerated"),
@SerializedName(value = "PresentationSent") PRESENTATION_SENT("PresentationSent"),
@SerializedName(value = "PresentationReceived") PRESENTATION_RECEIVED("PresentationReceived"),
@SerializedName(value = "PresentationVerified") PRESENTATION_VERIFIED("PresentationVerified"),
@SerializedName(value = "PresentationAccepted") PRESENTATION_ACCEPTED("PresentationAccepted"),
@SerializedName(value = "PresentationRejected") PRESENTATION_REJECTED("PresentationRejected"),
@SerializedName(value = "ProblemReportPending") PROBLEM_REPORT_PENDING("ProblemReportPending"),
@SerializedName(value = "ProblemReportSent") PROBLEM_REPORT_SENT("ProblemReportSent"),
@SerializedName(value = "ProblemReportReceived") PROBLEM_REPORT_RECEIVED("ProblemReportReceived"),
@SerializedName(value = "PresentationVerificationFailed") PRESENTATION_VERIFICATION_FAILED("PresentationVerificationFailed");
}
}

data class DidEvent(
@SerializedName("type") var type: String,
@SerializedName("id") var id: String,
Expand Down
Expand Up @@ -9,6 +9,7 @@ import io.iohk.atala.automation.extensions.get
import io.iohk.atala.automation.serenity.ensure.Ensure
import io.iohk.atala.automation.utils.Wait
import io.iohk.atala.prism.models.*
import models.PresentationStatusAdapter
import net.serenitybdd.rest.SerenityRest
import net.serenitybdd.screenplay.Actor
import org.apache.http.HttpStatus.SC_CREATED
Expand Down Expand Up @@ -57,7 +58,7 @@ class PresentProofSteps {
it.data.thid == bob.recall<String>("thid")
}
bob.remember("presentationId", proofEvent?.data?.presentationId)
proofEvent?.data?.status == PresentationStatus.Status.REQUEST_RECEIVED
proofEvent?.data?.status == PresentationStatusAdapter.Status.REQUEST_RECEIVED
}
}

Expand Down Expand Up @@ -95,7 +96,7 @@ class PresentProofSteps {
val proofEvent = ListenToEvents.with(bob).presentationEvents.lastOrNull {
it.data.thid == bob.recall<String>("thid")
}
proofEvent?.data?.status == PresentationStatus.Status.REQUEST_REJECTED
proofEvent?.data?.status == PresentationStatusAdapter.Status.REQUEST_REJECTED
}
}

Expand All @@ -108,7 +109,7 @@ class PresentProofSteps {
val proofEvent = ListenToEvents.with(faber).presentationEvents.lastOrNull {
it.data.thid == faber.recall<String>("thid")
}
proofEvent?.data?.status == PresentationStatus.Status.PRESENTATION_VERIFIED
proofEvent?.data?.status == PresentationStatusAdapter.Status.PRESENTATION_VERIFIED
}
}

Expand All @@ -122,7 +123,7 @@ class PresentProofSteps {
it.data.thid == verifier.recall<String>("thid")
}
println("Status? ${proofEvent?.data?.status}")
proofEvent?.data?.status == null // FIXME: change the comparison to PresentationStatus.Status.PRESENTATION_VERIFICATION_FAILED
proofEvent?.data?.status == PresentationStatusAdapter.Status.PRESENTATION_VERIFICATION_FAILED
}
}
}
Expand Up @@ -18,4 +18,3 @@ Feature: Credential revocation - JWT
And Holder receives the request
And Holder makes the presentation of the proof to Issuer
Then Issuer has the proof verified

0 comments on commit 28dd981

Please sign in to comment.