-
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.
test: add e2e test stub for different API variations
Signed-off-by: Yurii Shynbuiev <[email protected]>
- Loading branch information
1 parent
37b5db2
commit 27e3a27
Showing
10 changed files
with
207 additions
and
9 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
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
64 changes: 64 additions & 0 deletions
64
tests/integration-tests/src/test/kotlin/common/CreateCredentialOfferAPIVersion.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,64 @@ | ||
package common | ||
|
||
import org.hyperledger.identus.client.models.CreateIssueCredentialRecordRequest | ||
import java.util.UUID | ||
|
||
enum class CreateCredentialOfferAPIVersion { | ||
V0 { | ||
override fun buildCredentialOfferRequest( | ||
credentialType: CredentialType, | ||
did: String, | ||
assertionKey: String, | ||
schemaUrl: String?, | ||
claims: Map<String, Any>, | ||
connectionId: UUID, | ||
validityPeriod: Double?, | ||
): CreateIssueCredentialRecordRequest { | ||
return CreateIssueCredentialRecordRequest( | ||
schemaId = schemaUrl?.let { listOf(it) }, | ||
claims = claims, | ||
issuingDID = did, | ||
issuingKid = assertionKey, | ||
connectionId = connectionId, | ||
validityPeriod = validityPeriod ?: 3600.0, | ||
credentialFormat = credentialType.format, | ||
automaticIssuance = false, | ||
) | ||
} | ||
}, | ||
|
||
// TODO: it's a copy/paste from the V0, I have to regenerate the Kotlin HTTP client | ||
V1 { | ||
override fun buildCredentialOfferRequest( | ||
credentialType: CredentialType, | ||
did: String, | ||
assertionKey: String, | ||
schemaUrl: String?, | ||
claims: Map<String, Any>, | ||
connectionId: UUID, | ||
validityPeriod: Double?, | ||
): CreateIssueCredentialRecordRequest { | ||
return CreateIssueCredentialRecordRequest( | ||
schemaId = schemaUrl?.let { listOf(it) }, | ||
claims = claims, | ||
issuingDID = did, | ||
issuingKid = assertionKey, | ||
connectionId = connectionId, | ||
validityPeriod = validityPeriod ?: 3600.0, | ||
credentialFormat = credentialType.format, | ||
automaticIssuance = false, | ||
) | ||
} | ||
}, | ||
; | ||
|
||
abstract fun buildCredentialOfferRequest( | ||
credentialType: CredentialType, | ||
did: String, | ||
assertionKey: String, | ||
schemaUrl: String?, | ||
claims: Map<String, Any>, | ||
connectionId: UUID, | ||
validityPeriod: Double? = null, | ||
): CreateIssueCredentialRecordRequest | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/integration-tests/src/test/kotlin/common/CredentialClaims.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,19 @@ | ||
package common | ||
|
||
enum class CredentialClaims { | ||
STUDENT_CLAIMS { | ||
override val claims: Map<String, Any> = linkedMapOf( | ||
"name" to "Name", | ||
"age" to 18, | ||
) | ||
}, | ||
ID_CLAIMS { | ||
override val claims: Map<String, Any> = linkedMapOf( | ||
"firstName" to "First Name", | ||
"lastName" to "Last Name", | ||
) | ||
}, | ||
; | ||
|
||
abstract val claims: Map<String, Any> | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/integration-tests/src/test/kotlin/common/CredentialType.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,19 @@ | ||
package common | ||
|
||
enum class CredentialType { | ||
JWT_VCDM_1_1 { | ||
override val format: String = "JWT" | ||
}, | ||
JWT_VCDM_2_0 { | ||
override val format: String = "JWT" | ||
}, | ||
ANONCREDS_V1 { | ||
override val format: String = "AnonCreds" | ||
}, | ||
SD_JWT_VCDM_1_1 { | ||
override val format: String = "SD_JWT" | ||
}, | ||
; | ||
|
||
abstract val format: String | ||
} |
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
23 changes: 23 additions & 0 deletions
23
...tegration-tests/src/test/resources/features/credential/jwt/issuance-compatibility.feature
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,23 @@ | ||
@jwt @issuance @compatibility | ||
Feature: Issue JWT credential REST API compatibility | ||
|
||
Background: | ||
Given Issuer and Holder have an existing connection | ||
And Issuer has a published DID for 'JWT' | ||
And Issuer has a published 'STUDENT_SCHEMA' schema | ||
And Holder has an unpublished DID for 'JWT' | ||
|
||
Scenario Outline: Issuing jwt credential using different API version | ||
When Issuer prepares the credential in 'JWT_VCDM_1_1' format using the '<createCredentialOfferApiVersion>' API | ||
And Issuer prepares to use a 'short' form of DID with key id 'assertion-1' | ||
And Issuer prepares the 'STUDENT_SCHEMA' to issue the credential | ||
And Issuer prepares the claims '<claims>' for the credential | ||
And Issuer sends the prepared credential offer to Holder | ||
And Holder receives the credential offer | ||
And Holder accepts jwt credential offer using 'auth-1' key id | ||
And Issuer issues the credential | ||
Then Holder receives the issued credential | ||
Examples: | ||
| createCredentialOfferApiVersion | claims | | ||
| V0 | STUDENT_CLAIMS | | ||
|
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