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

add did resolve policy test

parent 17027566
No related branches found
No related tags found
1 merge request!15remove test results, initiate evaluate policy sync
......@@ -4,5 +4,8 @@
},
"unsuccessful_evaluate": {
"message": "wrong value!"
},
"didResolve_evaluate": {
"did":"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6"
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"doc": {
"type": "object",
"properties": {
"@context": {
"type": "string"
},
"didDocument": {
"type": "null"
},
"didDocumentMetadata": {
"type": "object"
},
"didResolutionMetadata": {
"type": "object",
"properties": {
"contentType": {
"type": "string"
}
},
"required": [
"contentType"
]
}
},
"required": [
"@context",
"didDocument",
"didDocumentMetadata",
"didResolutionMetadata"
]
}
},
"required": [
"doc"
]
}
\ No newline at end of file
......@@ -75,6 +75,23 @@ public class PolicyStepDefinitions extends BaseStepDefinitions {
policies.insertOne(test);
}
@Given("I upload a DID resolver policy to repository")
public void iUploadADIDResolverPolicyDidResolverToRepository() {
MongoClient client = MongoClients.create("mongodb://root:root@localhost:27017");
MongoDatabase database = client.getDatabase("policy");
MongoCollection<Document> policies = database.getCollection("policies");
Document test = new Document("_id", new ObjectId())
.append("filename", "didResolve_0.8.rego")
.append("name", "didResolve")
.append("group", "example")
.append("version", "1.0")
.append("locked", false)
.append("rego", "package example.didResolve\n" +
"doc = did.resolve(input.did)\n" +
"taskID := \"01234567\"");
policies.insertOne(test);
}
@And("set the policy to productive")
public void setThePolicyToProductive() throws Throwable {
}
......
......@@ -42,6 +42,15 @@ Feature: As user
And the field {taskID} has the value {0123456}
And delete policy {test1} from repository
Scenario: TSA - DID resolution - Positive
Given I upload a DID resolver policy to repository
Then I load the REST request {Policy.json} with profile {didResolve_evaluate}
And I execute the policy {/example/didResolve/1.0/evaluation}
Then the status code should be {200}
And the response is valid according to the {Policy_EvaluateDID_schema.json} REST schema
And the field {taskID} has the value {01234567}
And delete policy {didResolve} from repository
Scenario: TSA - Evaluate policy synchronously - Negative
Given I upload a policy {test6} to repository
And set the policy to productive
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment