-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anton Baliasnikov
committed
Dec 16, 2022
1 parent
369aaaa
commit e038880
Showing
12 changed files
with
246 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
MERCURY_MEDIATOR_VERSION=0.2.0 | ||
IRIS_SERVICE_VERSION=0.1.0 | ||
PRISM_AGENT_VERSION=0.17.0 | ||
PRISM_AGENT_VERSION=0.22.0 | ||
PORT=80 |
7 changes: 7 additions & 0 deletions
7
tests/e2e-tests/src/main/kotlin/api_models/PresentationProof.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package api_models | ||
|
||
data class PresentationProof( | ||
var presentationId: String? = null, | ||
var status: String? = null, | ||
var proofs: List<String>? = null | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
tests/e2e-tests/src/test/kotlin/features/present_proof/PresentProofSteps.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package features.present_proof | ||
|
||
import api_models.Connection | ||
import api_models.Credential | ||
import api_models.PresentationProof | ||
import common.Utils.lastResponseList | ||
import common.Utils.lastResponseObject | ||
import common.Utils.wait | ||
import io.cucumber.java.en.Then | ||
import io.cucumber.java.en.When | ||
import net.serenitybdd.screenplay.Actor | ||
import net.serenitybdd.screenplay.rest.interactions.Get | ||
import net.serenitybdd.screenplay.rest.interactions.Patch | ||
import net.serenitybdd.screenplay.rest.interactions.Post | ||
import net.serenitybdd.screenplay.rest.questions.ResponseConsequence | ||
import org.apache.http.HttpStatus.SC_CREATED | ||
import org.apache.http.HttpStatus.SC_OK | ||
|
||
class PresentProofSteps { | ||
@When("{actor} sends a request for proof presentation to {actor}") | ||
fun faberSendsARequestForProofPresentationToBob(faber: Actor, bob: Actor) { | ||
faber.attemptsTo( | ||
Post.to("/present-proof/presentations") | ||
.with { | ||
it.body(""" | ||
{ "connectionId": "${faber.recall<Connection>("connection-with-${bob.name}").connectionId}", "proofs":[] } | ||
""".trimIndent() | ||
) | ||
} | ||
) | ||
faber.should( | ||
ResponseConsequence.seeThatResponse("Presentation proof request created") { | ||
it.statusCode(SC_CREATED) | ||
} | ||
) | ||
faber.remember("presentationId", lastResponseObject("", PresentationProof::class).presentationId) | ||
} | ||
|
||
@When("{actor} makes the presentation of the proof to {actor}") | ||
fun bobMakesThePresentationOfTheProof(bob: Actor, faber: Actor) { | ||
wait( | ||
{ | ||
bob.attemptsTo( | ||
Get.resource("/present-proof/presentations") | ||
) | ||
bob.should( | ||
ResponseConsequence.seeThatResponse("Get presentations") { | ||
it.statusCode(SC_OK) | ||
} | ||
) | ||
lastResponseList("", PresentationProof::class).findLast { | ||
it.status == "RequestReceived" | ||
} != null | ||
}, | ||
"ERROR: Bob did not achieve any presentation request!" | ||
) | ||
|
||
val presentationId = lastResponseList("", PresentationProof::class).findLast { | ||
it.status == "RequestReceived" | ||
}!!.presentationId | ||
bob.attemptsTo( | ||
Patch.to("/present-proof/presentations/$presentationId").with { | ||
it.body(""" | ||
{ "action": "request-accept", "proofId": ["${bob.recall<Credential>("issuedCredential").recordId}"] } | ||
""".trimIndent() | ||
) | ||
} | ||
) | ||
} | ||
|
||
@When("{actor} acknowledges the proof") | ||
fun faberAcknowledgesTheProof(faber: Actor) { | ||
wait( | ||
{ | ||
faber.attemptsTo( | ||
Get.resource("/present-proof/presentations") | ||
) | ||
faber.should( | ||
ResponseConsequence.seeThatResponse("Get presentations") { | ||
it.statusCode(SC_OK) | ||
} | ||
) | ||
val presentation = lastResponseList("", PresentationProof::class).find { | ||
it.presentationId == faber.recall<String>("presentationId") | ||
} | ||
presentation!= null && presentation.status == "PresentationReceived" | ||
}, | ||
"ERROR: Faber did not receive presentation from Bob!" | ||
) | ||
|
||
} | ||
|
||
@Then("{actor} has the proof verified") | ||
fun faberHasTheProofVerified(faber: Actor) { | ||
wait( | ||
{ | ||
faber.attemptsTo( | ||
Get.resource("/present-proof/presentations") | ||
) | ||
faber.should( | ||
ResponseConsequence.seeThatResponse("Get presentations") { | ||
it.statusCode(SC_OK) | ||
} | ||
) | ||
val presentation = lastResponseList("", PresentationProof::class).find { | ||
it.presentationId == faber.recall<String>("presentationId") | ||
} | ||
presentation!= null && presentation.status == "PresentationVerified" | ||
}, | ||
"ERROR: presentation did not achieve PresentationVerified state!" | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.