-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: update DID tests with update and deactivation (#404)
- Loading branch information
abalias
authored
Mar 3, 2023
1 parent
8582dd6
commit 226a481
Showing
18 changed files
with
391 additions
and
47 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ on: | |
pull_request: | ||
paths: | ||
- ".github/workflows/e2e-tests.yml" | ||
- "infrastructure/shared/docker-compose.yml" | ||
- "tests/e2e-tests/**" | ||
push: | ||
branches: | ||
|
@@ -67,6 +68,7 @@ jobs: | |
- name: Start services for issuer | ||
env: | ||
PORT: 8080 | ||
NETWORK: prism | ||
uses: isbang/[email protected] | ||
with: | ||
compose-file: "./infrastructure/shared/docker-compose.yml" | ||
|
@@ -77,6 +79,7 @@ jobs: | |
- name: Start services for holder | ||
env: | ||
PORT: 8090 | ||
NETWORK: prism | ||
uses: isbang/[email protected] | ||
with: | ||
compose-file: "./infrastructure/shared/docker-compose.yml" | ||
|
@@ -160,4 +163,4 @@ jobs: | |
Skipped (known bugs): ${{ steps.analyze_test_results.outputs.skipped }} | ||
SLACK_TITLE: "Atala PRISM V2 E2E tests: ${{ steps.analyze_test_results.outputs.conclusion }}" | ||
SLACK_USERNAME: circleci | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
SLACK_WEBHOOK: ${{ secrets.E2E_TESTS_SLACK_WEBHOOK }} |
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,6 +1,6 @@ | ||
MERCURY_MEDIATOR_VERSION=0.2.0 | ||
IRIS_SERVICE_VERSION=0.1.0 | ||
PRISM_AGENT_VERSION=0.45.1 | ||
PRISM_AGENT_VERSION=0.48.3 | ||
PRISM_NODE_VERSION=v2.1.0 | ||
PORT=80 | ||
NETWORK=prism |
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
2 changes: 1 addition & 1 deletion
2
...lin/api_models/CreateManagedDidRequest.kt → ...otlin/api_models/CreatePrismDidRequest.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package api_models | ||
|
||
data class CreateManagedDidRequest( | ||
data class CreatePrismDidRequest( | ||
val documentTemplate: DocumentTemplate, | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package api_models | ||
|
||
data class Service( | ||
val id: String, | ||
val type: String, | ||
val serviceEndpoint: List<String>, | ||
var id: String = "", | ||
var serviceEndpoint: List<String> = listOf(""), | ||
var type: String = "", | ||
) |
14 changes: 14 additions & 0 deletions
14
tests/e2e-tests/src/main/kotlin/api_models/UpdatePrismDidRequest.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,14 @@ | ||
package api_models | ||
|
||
data class UpdatePrismDidRequest( | ||
val actions: List<UpdatePrismDidAction>, | ||
) | ||
|
||
data class UpdatePrismDidAction( | ||
val actionType: String? = null, | ||
val addKey: PublicKey? = null, | ||
val removeKey: PublicKey? = null, | ||
val addService: Service? = null, | ||
val removeService: Service? = null, | ||
val updateService: Service? = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,37 @@ | ||
package common | ||
|
||
import api_models.PublicKey | ||
import api_models.Purpose | ||
import api_models.Service | ||
import java.time.Duration | ||
import java.util.UUID | ||
|
||
object TestConstants { | ||
val CREDENTIAL_SCHEMAS = CredentialSchemas | ||
val RANDOM_CONSTAND_UUID = UUID.randomUUID().toString() | ||
val DID_UPDATE_PUBLISH_MAX_WAIT_5_MIN = Duration.ofSeconds(60L) | ||
val PRISM_DID_AUTH_KEY = PublicKey("auth-1", Purpose.AUTHENTICATION) | ||
val PRISM_DID_ASSERTION_KEY = PublicKey("assertion-1", Purpose.ASSERTION_METHOD) | ||
val PRISM_DID_UPDATE_NEW_AUTH_KEY = PublicKey("auth-2", Purpose.AUTHENTICATION) | ||
val PRISM_DID_SERVICE = Service( | ||
"https://foo.bar.com", | ||
listOf("https://foo.bar.com/"), | ||
"LinkedDomains", | ||
) | ||
val PRISM_DID_SERVICE_FOR_UPDATE = Service( | ||
"https://update.com", | ||
listOf("https://update.com/"), | ||
"LinkedDomains", | ||
) | ||
val PRISM_DID_SERVICE_TO_REMOVE = Service( | ||
"https://remove.com", | ||
listOf("https://remove.com/"), | ||
"LinkedDomains", | ||
) | ||
val PRISM_DID_UPDATE_NEW_SERVICE_URL = "https://bar.foo.com/" | ||
val PRISM_DID_UPDATE_NEW_SERVICE = Service( | ||
"https://new.service.com", | ||
listOf("https://new.service.com/"), | ||
"LinkedDomains", | ||
) | ||
} |
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
44 changes: 44 additions & 0 deletions
44
tests/e2e-tests/src/test/kotlin/features/did/DeactivateDidSteps.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,44 @@ | ||
package features.did | ||
|
||
import common.TestConstants | ||
import common.Utils | ||
import common.Utils.lastResponseObject | ||
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.Post | ||
import net.serenitybdd.screenplay.rest.questions.ResponseConsequence | ||
import org.apache.http.HttpStatus | ||
import org.hamcrest.Matchers | ||
|
||
class DeactivateDidSteps { | ||
|
||
@When("{actor} deactivates PRISM DID") | ||
fun actorIssuesDeactivateDidOperation(actor: Actor) { | ||
actor.attemptsTo( | ||
Post.to("/did-registrar/dids/${actor.recall<String>("shortFormDid")}/deactivations"), | ||
) | ||
actor.should( | ||
ResponseConsequence.seeThatResponse { | ||
it.statusCode(HttpStatus.SC_ACCEPTED) | ||
it.body("scheduledOperation.didRef", Matchers.not(Matchers.emptyString())) | ||
it.body("scheduledOperation.id", Matchers.not(Matchers.emptyString())) | ||
}, | ||
) | ||
} | ||
|
||
@Then("{actor} sees that PRISM DID is successfully deactivated") | ||
fun actorSeesThatPrismDidIsSuccessfullyDeactivated(actor: Actor) { | ||
Utils.wait( | ||
{ | ||
actor.attemptsTo( | ||
Get.resource("/dids/${actor.recall<String>("shortFormDid")}"), | ||
) | ||
lastResponseObject("metadata.deactivated", String::class) == "true" | ||
}, | ||
"ERROR: DID deactivate operation did not succeed on the ledger!", | ||
timeout = TestConstants.DID_UPDATE_PUBLISH_MAX_WAIT_5_MIN, | ||
) | ||
} | ||
} |
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.