Skip to content
Snippets Groups Projects
Commit 1ba49bb6 authored by Mike Sell's avatar Mike Sell
Browse files

Merge branch bdd:main into main

parents 86bcaa18 b6975826
No related branches found
No related tags found
No related merge requests found
Showing
with 798 additions and 0 deletions
.idea
.coverage
*.egg-info
pipeline {
agent {
kubernetes {
defaultContainer "python"
// language=yaml
yaml """
---
apiVersion: v1
kind: Pod
spec:
restartPolicy: Never
hostAliases: # this is a placeholder, to be updated when domain available
- ip: "10.111.252.111"
hostnames:
- "tcr.train1.xfsc.dev"
- "tspa.train1.xfsc.dev"
- "zonemgr.train1.xfsc.dev"
containers:
- name: python
# see `make docker-build-python-with-podman` how to build it, TODO: build and push with GitlabCI
image: "node-654e3bca7fbeeed18f81d7c7.ps-xaas.io/train/bdd/python_with_podman_v2:3.11"
command:
- cat
tty: true
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/lib/containers
name: podman-volume
- mountPath: /dev/shm
name: dev-shm-volume
- mountPath: /var/run
name: var-run-volume
- mountPath: /tmp
name: tmp-volume
volumes:
- name: podman-volume
emptyDir: {}
- name: dev-shm-volume
emptyDir:
medium: Memory
- name: var-run-volume
emptyDir: {}
- name: tmp-volume
emptyDir: {}
"""
}
}
environment {
EU_XFSC_BDD_CORE_PATH = "${WORKSPACE}/eclipse/xfsc/dev-ops/testing/bdd-executor"
VENV_PATH_DEV = "${WORKSPACE}/.cache/.venv"
PYLINTHOME = "${WORKSPACE}/.cache/pylint"
PIP_CACHE_DIR = "${WORKSPACE}/.cache/pip"
DOCKER = "podman"
}
stages {
stage('Clone sources') {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
mkdir -p "${EU_XFSC_BDD_CORE_PATH}/.."
cd "${EU_XFSC_BDD_CORE_PATH}/.."
git clone https://gitlab.eclipse.org/eclipse/xfsc/dev-ops/testing/bdd-executor.git \
-b 1-bdd-framework-migrate-train-bdd-testkit-2
"""
}
}
stage("Prepare cache folders") {
steps {
// language=sh
sh """#!/bin/bash
mkdir -p "${PYLINTHOME}/"
mkdir -p "${PIP_CACHE_DIR}/"
"""
}
}
stage("Build") {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
make setup_dev
"""
}
}
stage("Test") {
parallel {
stage("isort") {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
make isort
"""
}
}
stage("pylint") {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
export ARG_PYLINT_JUNIT=--output-format="junit"
make pylint > ".tmp/pylint.xml"
"""
}
post {
always {
recordIssues \
enabledForFailure: true,
aggregatingResults: true,
tool: pyLint(pattern: ".tmp/pylint.xml")
}
}
}
stage("coverage") {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
export ARG_COVERAGE_PYTEST=--junit-xml=".tmp/pytest.xml"
make coverage_run coverage_report
"""
}
post {
always {
junit ".tmp/pytest.xml"
}
}
}
stage("mypy") {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
export ARG_MYPY_SOURCE_XML=--junit-xml=".tmp/mypy-source.xml"
make mypy
"""
}
post {
always {
recordIssues enabledForFailure: true, tools: [myPy(pattern: ".tmp/mypy*.xml")]
}
}
}
stage("THIRD-PARTY.txt") {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
# third-party-license-file-generator
"""
}
}
stage("Run bdd test on ocm-e1") {
steps {
// language=sh
sh """#!/bin/bash
set -x -eu -o pipefail
mkdir -p ".tmp/behave/"
make run_bdd_dev
"""
}
}
}
}
stage("Deliver reports") {
steps {
// language=sh
sh """#!/bin/bash
echo "doing delivery stuff.."
"""
}
}
}
}
\ No newline at end of file
LICENSE 0 → 100644
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Makefile 0 → 100644
# see https://makefiletutorial.com/
SHELL := /bin/bash -eu -o pipefail
PYTHON_3 ?= python3
PYTHON_D ?= $(HOME)/.python.d
SOURCE_PATHS := "src"
VENV_PATH_DEV := $(PYTHON_D)/dev/eclipse/xfsc/dev-ops/testing/bdd-executor/ocm-e1
VENV_PATH_PROD := $(PYTHON_D)/prod/eclipse/xfsc/dev-ops/testing/bdd-executor/ocm-e1
EU_XFSC_BDD_CORE_PATH ?= ../..
setup_dev: $(VENV_PATH_DEV)
mkdir -p .tmp/
$(VENV_PATH_DEV):
$(PYTHON_3) -m venv $(VENV_PATH_DEV)
"$(VENV_PATH_DEV)/bin/pip" install -U pip wheel
cd $(EU_XFSC_BDD_CORE_PATH) && "$(VENV_PATH_DEV)/bin/pip" install -e ".[dev]"
"$(VENV_PATH_DEV)/bin/pip" install -e ".[dev]"
setup_prod: $(VENV_PATH_PROD)
$(VENV_PATH_PROD):
$(PYTHON_3) -m venv $(VENV_PATH_PROD)
"$(VENV_PATH_PROD)/bin/pip" install -U pip wheel
cd $(EU_XFSC_BDD_CORE_PATH) && "$(VENV_PATH_PROD)/bin/pip" install "."
"$(VENV_PATH_PROD)/bin/pip" install .
isort: setup_dev
"$(VENV_PATH_DEV)/bin/isort" $(SOURCE_PATHS) tests
pylint: setup_dev
"$(VENV_PATH_DEV)/bin/pylint" $${ARG_PYLINT_JUNIT:-} $(SOURCE_PATHS) tests
coverage_run: setup_dev
"$(VENV_PATH_DEV)/bin/coverage" run -m pytest $${ARG_COVERAGE_PYTEST:-} -m "not integration" tests/ src/
coverage_report: setup_dev
"$(VENV_PATH_DEV)/bin/coverage" report
mypy: setup_dev
"$(VENV_PATH_DEV)/bin/mypy" $${ARG_MYPY_SOURCE_XML:-} $(SOURCE_PATHS)
"$(VENV_PATH_DEV)/bin/mypy" $${ARG_MYPY_STEPS_XML:-} steps/ --disable-error-code=misc
code_check: \
setup_dev \
isort \
pylint \
coverage_run coverage_report \
mypy
run_bdd_prod: setup_prod
source "$(VENV_PATH_PROD)/bin/activate" && behave features/
run_bdd_dev: setup_dev
source "$(VENV_PATH_DEV)/bin/activate" && \
"$(VENV_PATH_DEV)/bin/coverage" run --append -m behave features/ --tags=-WIP
run_all_test_coverage: coverage_run run_bdd_dev coverage_report
clean_dev:
rm -rfv "$(VENV_PATH_DEV)"
clean_prod:
rm -rfv "$(VENV_PATH_PROD)"
activate_env_prod:
@echo "source \"$(VENV_PATH_PROD)/bin/activate\""
activate_env_dev:
@echo "source \"$(VENV_PATH_DEV)/bin/activate\""
ansible:
cd deployment/bare_metal && ansible-playbook main.ansible.yaml --connection=local -i localhost,
# OCM-E1 (Organisational Credential Manager Extension 1) Behaviour-driven development (BDD) framework
Based on XFSC Python based BDD lib [eu.xfsc.bdd.core].
# Description
CI Automation (Setup, Run and Reports) is set up with Jenkins.
Here's the pipeline visualization from the [Jenkinsfile](Jenkinsfile) `OCM-E1` pipeline:
![Jenkins-pipeline-visualisation-for-bdd.ocm-1.png](docs/Jenkins-pipeline-visualisation-for-bdd.ocm-e1.png)
The components' relationship is drawn in Plant UML syntax below.
```plantuml
@startuml
actor :User:
actor :Developer:
actor :Jenkins:
component "Didcomm Connector" as CM
component "Block Connection Endpoint" as BCM
component "SSI Abstraction Service" as SSIAS
package "BDD:repo eu.xfsc.bdd.ocm_e1" {
component Features
component Steps
}
Jenkins --|> User
Developer --|> User
User -up-> Features: execute
Steps --> CM
CM --> BCM
CM --> SSIAS
@enduml
```
# Getting started
## Requirements
* Clone
```bash
git clone git@gitlab.eclipse.org:eclipse/xfsc/ocm/bdd.git \
-b optional-branch-name-if-not-main
git clone git@gitlab.eclipse.org:eclipse/xfsc/dev-ops/testing/bdd-executor.git \
-b optional-branch-name-if-not-main
```
* Docker Engine (Docker Desktop, Podman machine, Rancher ...)
* For macOS or Linux, we provide below instructions on how to set up.
* For Windows, we recommend a dockerized setup or a remote (ssh) Linux dev server.
## Setup
For setup, look into [eu.xfsc.bdd.core/README.md].
## Run
### 1. Start all required services.
TBA
```bash
$ make TBA
```
TBA: Start Component as Docker container
> **_HINT:_** Ensure on macOS to start Docker Engine (Desktop Docker, Podman machine or Rancher)
before running the below command.
```bash
# Start component and leave it running as a process
$ make TBA
```
### 2. Execute BDD features [features](features)
```bash
make run_bdd_dev
```
## License
Apache License Version 2.0 see [LICENSE](LICENSE).
----------------------------------------------------------------------------------
[eu.xfsc.bdd.core]: https://gitlab.eclipse.org/eclipse/xfsc/dev-ops/testing/bdd-executor
[eu.xfsc.bdd.core/README.md]: https://gitlab.eclipse.org/eclipse/xfsc/dev-ops/testing/bdd-executor/-/blob/main/README.md?ref_type=heads#setup
\ No newline at end of file
docs/Jenkins-pipeline-visualisation-for-bdd.ocm-e1.png

178 KiB

As an OCM user
I want to create a new Credential Definition
Feature: Create a new Credential Definition
Create a new Credential Definition on Ledger and save details in DB
Scenario: Provide valid and required Credential Definition Details
Given I have passed all required credential definition details.
# src\credentialDef\controller\controller.ts -> REST API with POST method -> credentialDef/
When passed all valid credential definition details.
Then credential definition should be created on the Ledger with the given details.
And should return the newly created credential definition id.
And store the details in DB.
And I should get the HTTP status code 201 Created and the created Credential Definition Details.
Scenario: Provide invalid schemaID, name, created_by, is_revokable or is_auto_issue
Given I have passed schemaID, name, created_by, is_revokable and is_auto_issue.
# src\credentialDef\controller\controller.ts -> REST API with POST method -> credentialDef/
When passed invalid schemaID, name, created_by, is_revokable or is_auto_issue.
Then I should get HTTP status code 400 Bad Request.
Scenario: Provide name and schemaID of the existing Credential Definition.
Given I have passed all required credential definition details.
# src\credentialDef\controller\controller.ts -> REST API with POST method -> credentialDef/
When passed name and schemaID of the existing Credential Definition.
Then I should get HTTP status code 409 Conflict.
\ No newline at end of file
As an OCM user
I want to get all Credential Definitions by schema id
Feature: Get All Credential Definitions by schema id
Get All Credential Definitions from the DB by given schema id
Scenario: Provide valid schema id, page and page size.
Given I have passed the required schema id, page and page size.
# src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/
When passed details are valid.
Then I should get the HTTP status code 200 Ok and list of Credential Definitions from the DB.
Scenario: Provide invalid schema id.
Given I have passed the required schema id.
# src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/
When passed schema id is invalid.
Then I should get the HTTP status code 404 NOT Found.
\ No newline at end of file
As an OCM user
I want to find Credential Definition by id
Feature: Get Credential Definition by Id
Get Credential Definition by the given cred_def_id
Scenario: Provide valid cred_def_id.
Given I have passed the required cred_def_id.
# src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/:id
When passed cred_def_id is valid.
Then I should get the HTTP status code 200 Ok and Credential Definition from the DB.
Scenario: Provide invalid cred_def_id.
Given I have passed the required cred_def_id.
# src\credentialDef\controller\controller.ts -> REST API with GET method -> credentialDef/:id
When passed cred_def_id is invalid.
Then I should get the HTTP status code 404 Not Found.
As an OCM user
I want to accept a credential offer
Feature: Accept offer credential
Accept a credential offer
Scenario: Provide valid and required credentialId
Given I have passed all required details.
# src\issue-credential\controller\controller.ts -> REST API with POST method -> accept-request/
When passed all valid accept offer credential details.
Then credential offer should get accepted.
And I should get the HTTP status code 202 Accepted and the updated credential offer Details.
\ No newline at end of file
As an OCM user
I want to create a new CredentialType
Feature: Create a new CredentialType
Create a new CredentialType
Scenario: Provide valid and required CredentialType Details
Given I have passed all required credentialType details.
# src\issue-credential\controller\controller.ts -> REST API with POST method -> credentialType/
When passed all valid credentialType details.
Then credentialType should be created in DB.
And I should get the HTTP status code 201 Created and the created CredentialType Details.
Scenario: Provide invalid schema_id or type
Given I have passed schema_id and type.
# src\issue-credential\controller\controller.ts -> REST API with POST method -> credentialType/
When passed invalid schema_id or type.
Then I should get HTTP status code 400 Bad Request.
\ No newline at end of file
As an OCM user
I want to create credential offer
Feature: Create offer credential
Create a credential offer
Scenario: Provide valid and required connectionId, credentialDefinitionId, comment, preview and autoAcceptCredential
Given I have passed all required offer credential details.
# src\issue-credential\controller\controller.ts -> REST API with POST method -> create-offer-credential/
When passed all valid offer credential details.
Then credential offer should be sent to the given connection.
And I should get the HTTP status code 201 Created and the created credential offer Details.
\ No newline at end of file
As an OCM user
I want to get credentials
Feature: Get credential
Scenario: Provide valid credential_id
Given I have passed all required details.
# src\issue-credential\controller\controller.ts -> REST API with POST method -> credential/:id
When passed valid credential_id.
Then I should get the HTTP status code 200 Ok and the credential Details.
Scenario: Provide invalid credential_id
Given I have passed all required details.
# src\issue-credential\controller\controller.ts -> REST API with POST method -> credential/:id
When passed invalid credential_id.
Then I should get the HTTP status code 404 Not Found.
\ No newline at end of file
As an OCM user
I want to get the credentialType details of a given type
Feature: Get CredentialType details
Get the details of credentialType of given type
Scenario: Provide valid and required type
Given I have passed type.
# src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/getCredentialsTypeDetails'
When passed valid type.
Then I should get the details of the CredentialType.
\ No newline at end of file
As an OCM user
I want to get the credentials issued to a given connection
Feature: Get issued credentials of a given connection
Scenario: Provide valid and required connection_id
Given I have passed connection_id.
# src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/getIssueCredentials'
When passed valid connection_id.
Then I should get the list of Credentials Issued.
\ No newline at end of file
As an OCM user
I want to offer MemberShip Credentials
Feature: Offer Membership Credential
Offer a membership credential to User
Scenario: Provide valid and required status, connectionId, theirLabel and participantDid
Given AFJ Agent NATS Publisher have passed all required offer membership credential details.
# src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/offerMemberShipCredentials'
When passed all valid offer membership credential details.
Then credential offer should be sent to the given connection.
And I should get the HTTP status code 201 Created and the created membership credential offer Details.
\ No newline at end of file
As an OCM user
I want to update schema_id in credentialType of given type
Feature: Update schema_id by type
update schema_id in credentialType for given type
Scenario: Provide valid and required schema_id and type
Given I have passed all required details.
# src\issue-credential\controller\controller.ts -> REST API with POST method -> updateSchemaIdByType/
When passed valid schema_id and type.
Then credentialType should be updated.
And I should get the HTTP status code 200 Ok and the updated credentialType Details.
\ No newline at end of file
As an OCM user
I want to save the credential details from Webhook emitted by AFJ Agent
Feature: Credentials Webhook
Credential Webhook Emitted by AFJ
Scenario: A new Credential is offered
Given AFJ Agent have passed created credential details.
# src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/CredentialStateChanged'
When passed credential state is OFFER_SENT.
Then credential should be created in DB.
And I should get the HTTP status code 201 Created and the created credential Details.
Scenario: A Credential's state is changed
Given AFJ have passed the updated credential details.
# src\issue-credential\controller\controller.ts -> NATS call for topic 'ATTESTATION_MANAGER_SERVICE/CredentialStateChanged'
When passed credential state is not OFFER_SENT.
Then credential state should be updated in DB.
And I should get the HTTP status code 202 Accepted and the updated credential Details.
As an OCM user
I want to create a new Schema
Feature: Create a new Schema
Create a new Schema on Ledger and save details in DB
Scenario: Provide valid and required Schema Details
Given I have passed all required schema details.
# src\schemas\controller\controller.ts -> REST API with POST method -> schemas/
When passed all valid schema details.
Then schema should be created on the Ledger with the given details.
And should return the newly created Schema_ID.
And store the details in DB.
And I should get the HTTP status code 201 Created and the created Schema Details.
Scenario: Provide invalid name, created_by, version or attributes
Given I have passed name, created_by, version and attributes.
# src\schemas\controller\controller.ts -> REST API with POST method -> schemas/
When passed invalid name, created_by, version or attributes.
Then I should get the HTTP status code 400 Bad Request.
Scenario: Provide name and version of the existing Schema.
Given I have passed all required schema details.
# src\schemas\controller\controller.ts -> REST API with POST method -> schemas/
When passed name and version of the existing Schema.
Then I should get the HTTP status code 409 Conflict.
\ No newline at end of file
As an OCM user
I want to get the Schema by id
Feature: Get Schema by Id
Get Schema by the given schema id
Scenario: Provide valid schema id.
Given I have passed the required schema id.
# src\schemas\controller\controller.ts -> REST API with GET method -> schemas/:id
When passed schema id is valid.
Then I should get the HTTP status code 200 Ok and Schema from the DB.
Scenario: Provide invalid schema id.
Given I have passed the required schema id.
# src\schemas\controller\controller.ts -> REST API with GET method -> schemas/:id
When passed schema id is invalid.
Then I should get the HTTP status code 404 Not Found.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment