Skip to content
Snippets Groups Projects
Unverified Commit e5979782 authored by Georgi Michev's avatar Georgi Michev
Browse files

refactor did resolve policy test

parent a7acb039
Branches
Tags
1 merge request!15remove test results, initiate evaluate policy sync
#As user
#I want to evaluate the policy
#So I am able to execute it in the future
#
#@rest @all
#Scenario: Execute the policy
#When I upload the policy to repository
#And set the policy to productive
#And the policy successfully uploaded to the system
#When I execute the policy
#Then I get successful response
#And response contains the result of execution of the policy
#
#Acceptance criteria:
#- HTTP endpoint to evaluate the policy
#- example policy created and commited to Git repo
#- Green test based on example commited to the system
\ No newline at end of file
As policy administrator
I want to evaluate resolving DID feature
So I am able to use my DID features in the custom policies
Scenario: DID resolution
Given DID document is published
And the policy to resolve did is uploaded to the system
When I send a request containing DID
And DID method is in the list of supported ones
Then I get successful response
And response contains DID document
Acceptance criteria:
- published did document
- plugin for rego language to get/set values is ready to use
- example of usage of the plugin commited to the system
- green tests based on example commited to the system
\ No newline at end of file
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
"message": "wrong value!" "message": "wrong value!"
}, },
"didResolve_evaluate": { "didResolve_evaluate": {
"did":"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6" "did":"did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE"
} }
} }
\ No newline at end of file
{ {
"$schema": "http://json-schema.org/draft-04/schema#", "definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/object1655293265.json",
"title": "Root",
"type": "object", "type": "object",
"required": [
"data"
],
"properties": { "properties": {
"doc": { "data": {
"$id": "#root/data",
"title": "Data",
"type": "object", "type": "object",
"required": [
"@context",
"didDocument",
"didResolutionMetadata"
],
"properties": { "properties": {
"@context": { "@context": {
"type": "string" "$id": "#root/data/@context",
"title": "@context",
"type": "string",
"default": "",
"pattern": "^.*$"
}, },
"didDocument": { "didDocument": {
"type": "null" "$id": "#root/data/didDocument",
}, "title": "Diddocument",
"didDocumentMetadata": {
"type": "object"
},
"didResolutionMetadata": {
"type": "object", "type": "object",
"required": [
"authentication",
"id",
"verificationMethod"
],
"properties": { "properties": {
"contentType": { "authentication": {
"type": "string" "$id": "#root/data/didDocument/authentication",
"title": "Authentication",
"type": "array",
"default": [],
"items":{
"$id": "#root/data/didDocument/authentication/items",
"title": "Items",
"type": "string",
"default": "",
"pattern": "^.*$"
}
},
"id": {
"$id": "#root/data/didDocument/id",
"title": "Id",
"type": "string",
"default": "",
"pattern": "^.*$"
},
"verificationMethod": {
"$id": "#root/data/didDocument/verificationMethod",
"title": "Verificationmethod",
"type": "array",
"default": [],
"items":{
"$id": "#root/data/didDocument/verificationMethod/items",
"title": "Items",
"type": "object"
}
} }
}, }
"required": [
"contentType"
]
} }
}, ,
"required": [ "didResolutionMetadata": {
"@context", "$id": "#root/data/didResolutionMetadata",
"didDocument", "title": "Didresolutionmetadata",
"didDocumentMetadata", "type": "object"
"didResolutionMetadata" }
] }
} }
}, }
"required": [ }
"doc"
]
}
\ No newline at end of file
...@@ -81,13 +81,13 @@ public class PolicyStepDefinitions extends BaseStepDefinitions { ...@@ -81,13 +81,13 @@ public class PolicyStepDefinitions extends BaseStepDefinitions {
MongoDatabase database = client.getDatabase("policy"); MongoDatabase database = client.getDatabase("policy");
MongoCollection<Document> policies = database.getCollection("policies"); MongoCollection<Document> policies = database.getCollection("policies");
Document test = new Document("_id", new ObjectId()) Document test = new Document("_id", new ObjectId())
.append("filename", "didResolve_0.8.rego") .append("filename", "resolve_1.0.rego")
.append("name", "didResolve") .append("name", "resolve")
.append("group", "example") .append("group", "example")
.append("version", "1.0") .append("version", "1.0")
.append("locked", false) .append("locked", false)
.append("rego", "package example.didResolve\n" + .append("rego", "package example.resolve\n" +
"doc = did.resolve(input.did)\n" + "data = did.resolve(input.did)\n" +
"taskID := \"01234567\""); "taskID := \"01234567\"");
policies.insertOne(test); policies.insertOne(test);
} }
......
...@@ -42,14 +42,16 @@ Feature: As user ...@@ -42,14 +42,16 @@ Feature: As user
And the field {taskID} has the value {0123456} And the field {taskID} has the value {0123456}
And delete policy {test1} from repository And delete policy {test1} from repository
@test
Scenario: TSA - DID resolution - Positive Scenario: TSA - DID resolution - Positive
Given I upload a DID resolver policy to repository Given I upload a DID resolver policy to repository
Then I load the REST request {Policy.json} with profile {didResolve_evaluate} Then I load the REST request {Policy.json} with profile {didResolve_evaluate}
And I execute the policy {/example/didResolve/1.0/evaluation} And I execute the policy {/example/resolve/1.0/evaluation}
Then the status code should be {200} Then the status code should be {200}
And the response is valid according to the {Policy_EvaluateDID_schema.json} REST schema And the response is valid according to the {Policy_EvaluateDID_schema.json} REST schema
And the field {data.didDocument.id} has the value {did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE}
And the field {taskID} has the value {01234567} And the field {taskID} has the value {01234567}
And delete policy {didResolve} from repository And delete policy {resolve} from repository
Scenario: TSA - Evaluate policy synchronously - Negative Scenario: TSA - Evaluate policy synchronously - Negative
Given I upload a policy {test6} to repository Given I upload a policy {test6} to repository
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment