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

apply signer test

parent b77a68e5
No related branches found
No related tags found
1 merge request!22refactor step definitions
......@@ -244,6 +244,14 @@ public class JsonUtils {
return System.getProperty("baseUrl") + "/cache";
}
/**
* Get the url for "TSA Signer"
* @return the uri
*/
public static String getTSASigner() {
return System.getProperty("baseUrl") + "/signer";
}
/**
* Get the url for "TSA Task"
* @return the uri
......
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"controller": {
"type": "string"
},
"publicKeyJwk": {
"type": "object",
"properties": {
"kty": {
"type": "string"
},
"kid": {
"type": "string"
},
"crv": {
"type": "string"
},
"x": {
"type": "string"
},
"y": {
"type": "string"
}
},
"required": [
"kty",
"kid",
"crv",
"x",
"y"
]
}
},
"required": [
"id",
"type",
"controller",
"publicKeyJwk"
]
}
]
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"kind": {
"type": "integer"
}
},
"required": [
"id",
"kind"
]
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"controller": {
"type": "string"
},
"publicKeyJwk": {
"type": "object",
"properties": {
"kty": {
"type": "string"
},
"kid": {
"type": "string"
},
"crv": {
"type": "string"
},
"x": {
"type": "string"
},
"y": {
"type": "string"
}
},
"required": [
"kty",
"kid",
"crv",
"x",
"y"
]
}
},
"required": [
"id",
"type",
"controller",
"publicKeyJwk"
]
}
\ No newline at end of file
package api.test.rest.tsa.signer;
import api.test.core.BaseStepDefinitions;
import api.test.rest.RestGeneralStepDefinitions;
import api.test.rest.RestSessionContainer;
import core.*;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class SignerStepDefinitions extends BaseStepDefinitions {
private static final Logger logger = LogManager.getLogger(RestGeneralStepDefinitions.class.getSimpleName());
RestSessionContainer restSessionContainer;
Request currentRequest;
public SignerStepDefinitions(RestSessionContainer restSessionContainer, Request currentRequest, DataContainer dataContainer) {
super(dataContainer);
this.restSessionContainer = restSessionContainer;
this.currentRequest = currentRequest;
}
@Given("we are testing the TSA Signer Api")
public void weAreTestingTheTSASignerApi() {
RestClient.setDefaultEncoding("UTF8");
RestClient.setBaseURI(JsonUtils.getTSASigner());
RestClient.appendDefaultContentCharsetToContentTypeIfUndefined(false);
currentRequest.clear();
currentRequest.getHeaders().put("X-Client-UserAgent", "test framework");
currentRequest.setContentType("application/json");
}
@When("I get all keys via TSA Signer API")
public void iGetAllKeysViaTSASignerAPI() {
currentRequest.setPath("/v1/keys");
Response response = RestClient.get(currentRequest);
addRequest(currentRequest);
addResponse(response);
}
@When("^I get key \\{(.*)\\} via TSA Signer API$")
public void iGetKeyViaTSASignerAPI(String key) {
currentRequest.setPath("/v1/keys/" + key);
Response response = RestClient.get(currentRequest);
addRequest(currentRequest);
addResponse(response);
}
@When("I get issuer DID via TSA Signer API")
public void iGetSignerDIDViaTSASignerAPI() {
currentRequest.setPath("/v1/issuerDID");
Response response = RestClient.get(currentRequest);
addRequest(currentRequest);
addResponse(response);
}
}
#Copyright (c) 2018 Vereign AG [https://www.vereign.com]
#
#This is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as
#published by the Free Software Foundation, either version 3 of the
#License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU Affero General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#https://gaiax.vereign.com/tsa/signer/v1/issuerDID
#Author: Georgi Michev georgi.michev@vereign.com
@rest @all @tsa @signer
Feature: API -TSA - Signer Issuer DID - v1/keys POST
As user
I want to see what keys are available
So I am able to use them the future
Background:
Given we are testing the TSA Signer Api
Scenario: TSA - Getting Issuer DID - Positive
When I get issuer DID via TSA Signer API
And the status code should be {200}
And the field {did} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation}
\ No newline at end of file
#Copyright (c) 2018 Vereign AG [https://www.vereign.com]
#
#This is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as
#published by the Free Software Foundation, either version 3 of the
#License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU Affero General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#https://gaiax.vereign.com/tsa/signer/v1/keys
#Author: Georgi Michev georgi.michev@vereign.com
@rest @all @tsa @signer
Feature: API -TSA - Signer keys - v1/keys POST
As user
I want to see what keys are available
So I am able to use them the future
Background:
Given we are testing the TSA Signer Api
Scenario: TSA - Getting all keys from Singer - Positive
When I get all keys via TSA Signer API
And the status code should be {200}
And the response is valid according to the {Signer_GetAllKeys_schema.json} REST schema
And the field {$..type} has the value {["JsonWebKey2020","JsonWebKey2020"]}
And the field {$..publicKeyJwk.kid} has the value {["key1","key2"]}
And the field {$..publicKeyJwk.crv} has the value {["P-256","Ed25519"]}
Scenario: TSA - Getting key1 from Singer - Positive
When I get key {key1} via TSA Signer API
And the status code should be {200}
And the response is valid according to the {Signer_GetKey_schema.json} REST schema
And the field {type} has the value {JsonWebKey2020}
And the field {publicKeyJwk.kid} has the value {key1}
And the field {publicKeyJwk.crv} has the value {P-256}
Scenario: TSA - Getting non existing key - Negative
When I get key {non_existing} via TSA Signer API
And the response is valid according to the {Signer_GetKey_negative_schema.json} REST schema
And the status code should be {404}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment