diff --git a/src/main/resources/REST/json/AttestationCreateCredentialDef.json b/src/main/resources/REST/json/AttestationCreateCredentialDef.json index fe002aae3e3e849bff21b700accffb826efa0312..89f3fc0faae1c87db4cf5e2639e5230f2d489af4 100644 --- a/src/main/resources/REST/json/AttestationCreateCredentialDef.json +++ b/src/main/resources/REST/json/AttestationCreateCredentialDef.json @@ -6,5 +6,79 @@ "schemaID": "123456", "createdBy": "acceptsAnyString", "expiryHours": "24" + }, + "missing_name": { + "isRevokable": false, + "isAutoIssue": false, + "schemaID": "123456", + "createdBy": "acceptsAnyString", + "expiryHours": "24" + }, + "missing_isRevokable": { + "name": "Automation_CredDef_001", + "isAutoIssue": false, + "schemaID": "123456", + "createdBy": "acceptsAnyString", + "expiryHours": "24" + }, + "missing_isAutoIssue": { + "name": "Automation_CredDef_001", + "isRevokable": false, + "schemaID": "123456", + "createdBy": "acceptsAnyString", + "expiryHours": "24" + }, + "missing_createdBy": { + "name": "Automation_CredDef_001", + "isRevokable": false, + "isAutoIssue": false, + "schemaID": "123456", + "expiryHours": "24" + }, + "missing_schemaID": { + "name": "Automation_CredDef_001", + "isRevokable": false, + "isAutoIssue": false, + "createdBy": "acceptsAnyString", + "expiryHours": "24" + }, + "missing_expiryHours": { + "name": "Automation_CredDef_001", + "isRevokable": false, + "isAutoIssue": false, + "schemaID": "123456", + "createdBy": "acceptsAnyString" + }, + "empty_name": { + "name": "", + "isRevokable": false, + "isAutoIssue": false, + "schemaID": "123456", + "createdBy": "acceptsAnyString", + "expiryHours": "24" + }, + "empty_schemaID": { + "name": "Automation_CredDef_001", + "isRevokable": false, + "isAutoIssue": false, + "schemaID": "", + "createdBy": "acceptsAnyString", + "expiryHours": "24" + }, + "empty_createdBy": { + "name": "Automation_CredDef_001", + "isRevokable": false, + "isAutoIssue": false, + "schemaID": "123456", + "createdBy": "", + "expiryHours": "24" + }, + "empty_expiryHours": { + "name": "Automation_CredDef_001", + "isRevokable": false, + "isAutoIssue": false, + "schemaID": "123456", + "createdBy": "acceptsAnyString", + "expiryHours": "" } } \ No newline at end of file diff --git a/src/main/resources/REST/json/AttestationCreateSchemas.json b/src/main/resources/REST/json/AttestationCreateSchemas.json index b0c1807ea586fdc788d83040d80a0286ed924e21..7ac0c3bfce51ae5094f97bb03ed4229f559ed810 100644 --- a/src/main/resources/REST/json/AttestationCreateSchemas.json +++ b/src/main/resources/REST/json/AttestationCreateSchemas.json @@ -7,5 +7,78 @@ "gender" ], "createdBy": "2344789247389" + }, + "missing_name": { + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "2344789247389" + }, + "missing_attributes": { + "name": "automation_testing_schema1-01", + "createdBy": "2344789247389" + }, + "missing_createdBy": { + "name": "automation_testing_schema1-01", + "attributes": [ + "fName", + "lName", + "gender" + ] + }, + "empty_name": { + "name": "", + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "2344789247389" + }, + "empty_attributes": { + "name": "automation_testing_schema1-01", + "attributes": [ + ], + "createdBy": "2344789247389" + }, + "empty_createdBy": { + "name": "automation_testing_schema1-01", + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "" + }, + "empty_version": { + "name": "automation_testing_schema1-01", + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "2344789247389", + "version": "" + }, + "missing_version": { + "name": "automation_testing_schema1-01", + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "2344789247389" + }, + "wrong_format_version": { + "name": "automation_testing_schema1-01", + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "2344789247389", + "version": "1123131" } } \ No newline at end of file diff --git a/src/main/resources/REST/schemas/Attestation_GET_credential.json b/src/main/resources/REST/schemas/Attestation_GET_credential.json new file mode 100644 index 0000000000000000000000000000000000000000..338b2d4c46eadc6c6549444035d04bdac0ad1164 --- /dev/null +++ b/src/main/resources/REST/schemas/Attestation_GET_credential.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "statusCode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "records": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "credentialId": { + "type": "string" + }, + "credDefId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "state": { + "type": "string" + }, + "principalDid": { + "type": "string" + }, + "connectionId": { + "type": "string" + }, + "createdDate": { + "type": "string" + }, + "updatedDate": { + "type": "string" + }, + "expirationDate": { + "type": "string" + } + }, + "required": [ + "id", + "credentialId", + "credDefId", + "threadId", + "state", + "principalDid", + "connectionId", + "createdDate", + "updatedDate", + "expirationDate" + ] + } + ] + } + }, + "required": [ + "count", + "records" + ] + } + }, + "required": [ + "statusCode", + "message", + "data" + ] +} \ No newline at end of file diff --git a/src/main/resources/REST/schemas/Attestation_GET_credentialDef.json b/src/main/resources/REST/schemas/Attestation_GET_credentialDef.json new file mode 100644 index 0000000000000000000000000000000000000000..341461f5b36602daf18e6d63cffc000d6dcb9de0 --- /dev/null +++ b/src/main/resources/REST/schemas/Attestation_GET_credentialDef.json @@ -0,0 +1,85 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "statusCode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "records": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "schemaID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "credDefId": { + "type": "string" + }, + "isAutoIssue": { + "type": "boolean" + }, + "isRevokable": { + "type": "boolean" + }, + "expiryHours": { + "type": "string" + }, + "createdBy": { + "type": "string" + }, + "createdDate": { + "type": "string" + }, + "updatedBy": { + "type": "string" + }, + "updatedDate": { + "type": "string" + } + }, + "required": [ + "id", + "schemaID", + "name", + "credDefId", + "isAutoIssue", + "isRevokable", + "expiryHours", + "createdBy", + "createdDate", + "updatedBy", + "updatedDate" + ] + } + ] + } + }, + "required": [ + "count", + "records" + ] + } + }, + "required": [ + "statusCode", + "message", + "data" + ] +} \ No newline at end of file diff --git a/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java b/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java index b5dd3c3a2a29dd080164d0c620649e5065eee8d1..b8f568a18575ef72edbbcb0d8d8130fa811f4c63 100644 --- a/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java +++ b/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java @@ -187,4 +187,69 @@ public class AttestationStepDefinitions extends BaseStepDefinitions { I_create_an_offer_credential_via_OCM_Api(); } + + @Given("^I get a credential definition with credDefId \\{(.*?)\\} via OCM Api") + public void I_get_a_credential_definition_with_credDefId_via_OCM_Api(String credDef) { + currentRequest.setPath("/attestation/v1/credentialDef/" + credDef); + + Response response = RestClient.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } + + @Given("^I get current Credential definition via OCM API") + public void I_get_current_Credential_definition_via_OCM_API() { + I_get_a_credential_definition_with_credDefId_via_OCM_Api(restSessionContainer.getCurrentCredentialDef().getData().getCredDefId()); + } + + @Given("^I accept request by providing credentialid \\{(.*?)\\} via OCM Api") + public void I_accept_request_by_providing_credentialid__via_OCM_Api(String credentialId) { + currentRequest.setPath("/attestation/v1/accept-request?credentialId=" + credentialId); + + Response response = RestClient.post(currentRequest); + addRequest(currentRequest); + addResponse(response); + } + + @Given("^I accept request for the current credentialId via OCM Api") + public void I_accept_request_for_the_current_credentialId_via_OCM_Api() { + I_accept_request_by_providing_credentialid__via_OCM_Api(restSessionContainer.getCurrentCredentialDef().getData().getCredDefId()); + } + + @Given("^I get all credentials via OCM Api") + public void I_get_all_credentials_via_OCM_Api() { + currentRequest.setPath("/attestation/v1/credential"); + + Response response = RestClient.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } + + @Given("^I get all credentials with pageSize \\{(.*?)\\} and page \\{(.*?)\\} via OCM api") + public void I_get_all_credentials_with_pageSize_and_page_via_OCM_api(String pageSize,String page) { + HashMap<String, String> queryParams = new HashMap<>(); + queryParams.put("pageSize",pageSize); + queryParams.put("page",page); + currentRequest.setQueryParams(queryParams); + + I_get_all_credentials_via_OCM_Api(); + } + + @Given("^I get a credential definition with schemaID \\{(.*?)\\} via OCM Api") + public void I_get_a_credential_definition_with_schemaID_via_OCM_Api(String schemaID) { + currentRequest.setPath("/attestation/v1/credentialDef?schemaID=" + schemaID); + + Response response = RestClient.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } + + @Given("^I get a credential definition with the current schemaID via OCM Api") + public void I_get_a_credential_definition_with_the_current_schemaID_via_OCM_Api() { + currentRequest.setPath("/attestation/v1/credentialDef?schemaID=" + restSessionContainer.getCurrentSchema().getData().getSchemaID()); + + Response response = RestClient.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } } \ No newline at end of file diff --git a/src/test/java/api/test/rest/ocm/connection/ConnectionStepDefinitions.java b/src/test/java/api/test/rest/ocm/connection/ConnectionStepDefinitions.java index 90d7e934d33e353f12ab12f04b07887b4effe428..d14b7fa06f073afa6ad247980fc316f6e3910fd2 100644 --- a/src/test/java/api/test/rest/ocm/connection/ConnectionStepDefinitions.java +++ b/src/test/java/api/test/rest/ocm/connection/ConnectionStepDefinitions.java @@ -115,4 +115,13 @@ public class ConnectionStepDefinitions extends BaseStepDefinitions { addRequest(currentRequest); addResponse(response); } + + @Given("^an administrator fetches the current connection via OCM Api") + public void an_administrator_fetches_the_current_connection_via_OCM_Api() { + currentRequest.setPath("/connection/v1/connections/" + restSessionContainer.getCurrentConnection().getData().getConnection().getId()); + + Response response = RestClient.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } } \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/accept-request/POST.feature b/src/test/resources/features/ocm/attestation/v1/accept-request/POST.feature new file mode 100644 index 0000000000000000000000000000000000000000..51105968e468b086ea77fe541f2012d54585701c --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/accept-request/POST.feature @@ -0,0 +1,43 @@ +#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/>. + +#http://localhost/ocm/attestation/v1/accept-request?credentialId=:credentialDef +#Author: Rosen Georgiev rosen.georgiev@vereign.com +#NOTE: Cannot be tested without PCM to receive an Credential Offer + +@rest @all @ocm @attestation +Feature: API - OCM - attestation - v1 - accept-request POST + It is used to accept the acknowledgement received from another Aries agent + for the issuance for Verifiable Credential and send Verifiable Credential. + + Background: + Given we are testing the OCM Api + + @cred @wip + Scenario: OCM - Attestation - Creation of credential definition based on a newly created schema - Positive + #Creation of the schema + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + Then the field {statusCode} contains the value {201} + And the status code should be {201} + #Creation of the Credential definition + And I clear the request body + Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} + Then I create a new credential definition with the current schemaId via OCM Api + And the status code should be {201} + #Trying to accept a newly created Credential Def without being offered and approved by PCM + And I clear the request body + Given I accept request for the current credentialId via OCM Api + And the status code should be {201} \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/credential/GET.feature b/src/test/resources/features/ocm/attestation/v1/credential/GET.feature new file mode 100644 index 0000000000000000000000000000000000000000..56b871dbe0fafe578ca10dd426afd5b36003ac79 --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/credential/GET.feature @@ -0,0 +1,51 @@ +#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/>. + +#http://localhost/ocm/attestation/v1/credential +#Author: Rosen Georgiev rosen.georgiev@vereign.com + +@rest @all @ocm @attestation +Feature: API - OCM - attestation - v1 - credential GET + This request fetches the issued verifiable credentials. + It uses pagination to provide the particular number of records filtered as per the input given. + + Background: + Given we are testing the OCM Api + + @cred + Scenario: OCM - Attestation - Get all Credentials - Positive + Then I get all credentials via OCM Api + And the status code should be {200} + And the field {statusCode} contains the value {200} + And the field {message} contains the value {Credential fetch successfully} + And the response is valid according to the {Attestation_GET_credential.json} REST schema + + @cred + Scenario: OCM - Attestation - Get all Credentials with pagination without any records - Positive + Then I get all credentials with pageSize {9999} and page {9999} via OCM api + And the status code should be {200} + And the field {statusCode} contains the value {200} + And the field {message} contains the value {Credential fetch successfully} + And the response is valid according to the {Attestation_GET_credential.json} REST schema + And the field {$.data.records} contains {0} elements + + @cred + Scenario: OCM - Attestation - Get all Credentials with pagination for just 5 records - Positive + Then I get all credentials with pageSize {5} and page {0} via OCM api + And the status code should be {200} + And the field {statusCode} contains the value {200} + And the field {message} contains the value {Credential fetch successfully} + And the response is valid according to the {Attestation_GET_credential.json} REST schema + And the field {$.data.records} contains {5} elements \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/credentialDef/GET.feature b/src/test/resources/features/ocm/attestation/v1/credentialDef/GET.feature new file mode 100644 index 0000000000000000000000000000000000000000..6df0d83d9eab87a767419f58e925c3aa951ef6cf --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/credentialDef/GET.feature @@ -0,0 +1,82 @@ +#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/>. + +#http://localhost/ocm/attestation/v1/credentialDef?schemaID=:schemaID +#Author: Rosen Georgiev rosen.georgiev@vereign.com + +@rest @all @ocm @attestation +Feature: API - OCM - attestation - v1 - credentialDef - :schemaID GET + This request fetches the created credentials against provided schema_id. + It uses pagination to provide the particular number of records filtered as per the input given. + + Background: + Given we are testing the OCM Api + + @cred + Scenario: OCM - Attestation - Get credentialDef with SchemaID - Positive + #Creation of the schema + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + And the status code should be {201} + #Creation of the Credential definition + And I clear the request body + Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} + Then I create a new credential definition with the current schemaId via OCM Api + And the status code should be {201} + #Get Credential Definitions via SchemaID + And I clear the request body + Given I get a credential definition with the current schemaID via OCM Api + And the status code should be {200} + And the response is valid according to the {Attestation_GET_credentialDef.json} REST schema + Then the field {statusCode} contains the value {200} + Then the field {message} contains the value {Credential definitions fetch successfully} + Then the field {$..name} contains the value {Automation_CredDef_001} + Then the field {$.data.count} contains the value {1} + Then the field {$.data.records} contains the value {1} + + @cred + Scenario: OCM - Attestation - Create 2 Credential Def with the same Schema and then GET it - Positive + #Creation of the schema + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + And the status code should be {201} + #Creation of the Credential definition + And I clear the request body + Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} + Then I create a new credential definition with the current schemaId via OCM Api + And the status code should be {201} + #Creation of 2nd Credential definition with the same schemaID + Given I set the request fields + | name | Automation_CredDef_002 | + Then I create a new credential definition via OCM Api + And the status code should be {201} + #Get Credential Definitions via SchemaID + And I clear the request body + Given I get a credential definition with the current schemaID via OCM Api + And the status code should be {200} + And the response is valid according to the {Attestation_GET_credentialDef.json} REST schema + Then the field {statusCode} contains the value {200} + Then the field {message} contains the value {Credential definitions fetch successfully} + Then the field {$.data.count} contains the value {2} + Then the field {$..name} contains the value {Automation_CredDef_001} + Then the field {$..name} contains the value {Automation_CredDef_002} + Then the field {$.data.records} contains the value {2} + + @cred @negative + Scenario: OCM - Attestation - Try to get Credential Definition with non existant schemaID- Negative + Given I get a credential definition with schemaID {test1234} via OCM Api + Then the field {statusCode} contains the value {404} + And the status code should be {404} + Then the field {message} contains the value {Credential definitions fetch successfully} \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/credentialDef/POST.feature b/src/test/resources/features/ocm/attestation/v1/credentialDef/POST.feature index 61a7e198bdbeaf25dc87e42950081197164ce4b8..5b6bf429ba232fca6c80ff015822e08cb11b953e 100644 --- a/src/test/resources/features/ocm/attestation/v1/credentialDef/POST.feature +++ b/src/test/resources/features/ocm/attestation/v1/credentialDef/POST.feature @@ -44,4 +44,64 @@ Feature: API - OCM - attestation - v1 - credentialDef POST And the field {$.data.isAutoIssue} contains the value {false} And the field {$.data.isRevokable} contains the value {false} And the field {$.data.expiryHours} contains the value {24} - And the field {$.data.name} contains the value {Automation_CredDef_001} \ No newline at end of file + + @cred @negative + Scenario Outline: OCM - Attestation - Try to create a credential def with invalid data <json> - Negative + Given I load the REST request {AttestationCreateCredentialDef.json} with profile {<json>} + Then I create a new credential definition via OCM Api + And the status code should be {400} + And the field {message} contains the value {Credential definition required following attributes ( schemaID, name, isRevokable, isAutoIssue, createdBy, expiryHours )} + And the field {statusCode} contains the value {400} + Examples: + | json | + | missing_name | + | missing_isRevokable | + | missing_isAutoIssue | + | missing_createdBy | + | missing_schemaID | + | missing_expiryHours | + | empty_name | + | empty_schemaID | + | empty_createdBy | + | empty_expiryHours | + + @cred @negative + Scenario: OCM - Attestation - Try to create 2nd credential def with the same SchemaID and same name - Negative + #Creation of the schema + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + And the status code should be {201} + #Creation of the Credential definition + And I clear the request body + Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} + Then I create a new credential definition with the current schemaId via OCM Api + And the status code should be {201} + #Creation of 2nd Credential definition with the same schemaID + Then I create a new credential definition via OCM Api + And the status code should be {409} + And the field {statusCode} contains the value {409} + And the field {message} contains the value {Credential definition already exists} + + @cred + Scenario: OCM - Attestation - Create a second Credential Definition under the same schema with different name - Positive + #Creation of the schema + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + And the status code should be {201} + #Creation of the Credential definition + And I clear the request body + Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} + Then I create a new credential definition with the current schemaId via OCM Api + And the status code should be {201} + #Creation of 2nd Credential definition with the same schemaID + Given I set the request fields + | name | Automation_CredDef_002 | + Then I create a new credential definition via OCM Api + And the status code should be {201} + And the response is valid according to the {Attestation_POST_credentialDef.json} REST schema + And the field {message} contains the value {Credential definition created successfully} + And the field {statusCode} contains the value {201} + And the field {$.data.name} contains the value {Automation_CredDef_002} + And the field {$.data.isAutoIssue} contains the value {false} + And the field {$.data.isRevokable} contains the value {false} + And the field {$.data.expiryHours} contains the value {24} diff --git a/src/test/resources/features/ocm/attestation/v1/credentialDef/{credentialDef}/GET.feature b/src/test/resources/features/ocm/attestation/v1/credentialDef/{credentialDef}/GET.feature new file mode 100644 index 0000000000000000000000000000000000000000..e9b05caf6f870c73cfee6860001ff64d4da9967a --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/credentialDef/{credentialDef}/GET.feature @@ -0,0 +1,50 @@ +#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/>. + +#http://localhost/ocm/attestation/v1/credentialDef/:credentialDef +#Author: Rosen Georgiev rosen.georgiev@vereign.com + +@rest @all @ocm @attestation +Feature: API - OCM - attestation - v1 - credentialDef - :credentialDefId GET + This request is used to fetch credential definitions for the provided cred_def_id in URL. + + Background: + Given we are testing the OCM Api + + @cred + Scenario: OCM - Attestation - Get the newly created CredentialDef - Positive + #Creation of the schema + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + Then the field {statusCode} contains the value {201} + And the status code should be {201} + #Creation of the Credential definition + And I clear the request body + Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} + Then I create a new credential definition with the current schemaId via OCM Api + And the status code should be {201} + #Get the newly created Credential Definition + And I clear the request body + Then I get current Credential definition via OCM API + And the status code should be {200} + And the field {statusCode} contains the value {200} + And the response is valid according to the {Attestation_GET_credentialDef.json} REST schema + + @cred @negative + Scenario: OCM - Attestation - Try to get a credential def with invalid id - Positive + Then I get a credential definition with credDefId {invalidCredDefId} via OCM Api + And the status code should be {404} + And the field {statusCode} contains the value {404} + And the field {message} contains the value {No Data found} \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature b/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature index 3af3de3af97536925ebe2859bd5ea0a9d5441602..24d965ed2c4bed8e08444adb458befadd203fc6c 100644 --- a/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature +++ b/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature @@ -40,4 +40,44 @@ Feature: API - OCM - attestation - v1 - schemas POST And the field {$..attribute..name} contains the value {fName} And the field {$..attribute..name} contains the value {lName} And the field {$..attribute..name} contains the value {gender} - And the field {$..attribute..name} contains the value {expirationDate} \ No newline at end of file + And the field {$..attribute..name} contains the value {expirationDate} + + @schemas @negative + Scenario: OCM - Attestation - Try to create a new schema with existing version - Negative + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + Then the field {statusCode} contains the value {201} + And the status code should be {201} + Given I create a new schema via Attestation Manager in OCM api + And the status code should be {409} + And the field {statusCode} contains the value {409} + And the field {message} contains the value {Schema already exists} + + @schemas @negative + Scenario Outline: OCM - Attestation - Try to create a new schema with invalid data <json> - Negative + Given I load the REST request {AttestationCreateSchemas.json} with profile {<json>} + Then I create a new schema with random version via Attestation Manager in OCM api + Then the field {statusCode} contains the value {400} + And the status code should be {400} + And the field {message} contains the value {Schema required following attributes ( name, createdBy, version, attributes )} + Examples: + | json | + | missing_name | + | missing_attributes | + | missing_createdBy | + | empty_name | + | empty_attributes | + | empty_createdBy | + + @schemas @negative + Scenario Outline: OCM - Attestation - Try to create a new schema with invalid version <json> - Negative + Given I load the REST request {AttestationCreateSchemas.json} with profile {<json>} + Then I create a new schema via Attestation Manager in OCM api + Then the field {statusCode} contains the value {400} + And the status code should be {400} + And the field {message} contains the value {Schema required following attributes ( name, createdBy, version, attributes )} + Examples: + | json | + | empty_version | + | missing_version | + | wrong_format_version | \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/schemas/{schemaID}/GET.feature b/src/test/resources/features/ocm/attestation/v1/schemas/{schemaID}/GET.feature index 3b227307f4be38b227e48941ad961bef70f6cfd1..0158df53d9bd46034d5b58d706066003285b74be 100644 --- a/src/test/resources/features/ocm/attestation/v1/schemas/{schemaID}/GET.feature +++ b/src/test/resources/features/ocm/attestation/v1/schemas/{schemaID}/GET.feature @@ -34,4 +34,11 @@ Feature: API - OCM - attestation - v1 - schemas - :schemaID GET And the status code should be {200} And the response is valid according to the {Attestation_GET_schemas.json} REST schema And the field {message} contains the value {Schema fetch successfully} - And the field {$.data.count} contains the value {1} \ No newline at end of file + And the field {$.data.count} contains the value {1} + + @schemas @negative + Scenario: OCM - Attestation - Try to get schema by providing invalid schemaID - Positive + Given I get schema with schemaID {test12313} via OCM Api + Then the field {statusCode} contains the value {404} + And the status code should be {404} + And the field {message} contains the value {No Data found} \ No newline at end of file diff --git a/src/test/resources/features/ocm/connection/v1/connections/{connectionId}/GET.feature b/src/test/resources/features/ocm/connection/v1/connections/{connectionId}/GET.feature index 57bdac5a83a55fdbdc04982bbe3740b2e18dd960..dde1bc64fa9affea159d711b0d0f68587b2b4828 100644 --- a/src/test/resources/features/ocm/connection/v1/connections/{connectionId}/GET.feature +++ b/src/test/resources/features/ocm/connection/v1/connections/{connectionId}/GET.feature @@ -24,6 +24,19 @@ Feature: API - OCM - connection - v1 - connections - connectionId GET Background: Given we are testing the OCM Api + @connection + Scenario: OCM - Creating a new process connection with alias <alias>- Positive +#Create a new member process connection + Given an administrator generates a QR code by creating a connection with alias {member} via OCM api + Then the field {statusCode} contains the value {200} + And the status code should be {201} +#Get the current Connection + Given an administrator fetches the current connection via OCM Api + Then the field {statusCode} contains the value {200} + And the status code should be {200} + Then the field {message} contains the value {Connections fetch successfully} + Then the field {$.data.records.status} contains the value {invited} + @connections @negative Scenario Outline: OCM - Try to get connection by providing invalid connectionID - <connId> - Negative Given an administrator fetches connection with connectionId {<connId>} @@ -31,4 +44,5 @@ Feature: API - OCM - connection - v1 - connections - connectionId GET Then the field {message} contains the value {No Data found} Examples: | connId | - | dasdasdas | \ No newline at end of file + | dasdasdas | +