Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ocm-bdd-2-qa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mike Sell
ocm-bdd-2-qa
Commits
ad9f5bc0
Commit
ad9f5bc0
authored
1 year ago
by
Mike Sell
Browse files
Options
Downloads
Patches
Plain Diff
Added implementation for Credential definitions scenarios
parent
e72a849e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
features/steps/credential_definitions.py
+25
-17
25 additions, 17 deletions
features/steps/credential_definitions.py
features/steps/init.py
+7
-7
7 additions, 7 deletions
features/steps/init.py
features/steps/schema.py
+1
-2
1 addition, 2 deletions
features/steps/schema.py
with
33 additions
and
26 deletions
features/steps/credential_definitions.py
+
25
−
17
View file @
ad9f5bc0
...
...
@@ -2,17 +2,17 @@ from behave import *
import
json
from
helper
import
generate_random_string
,
post_credential_definition
,
list_credential_definitions
from
init
import
step_init
,
step_register_issuer_did
from
schema
import
post_schema_complete
,
error_409
@when
(
u
'
I register a credential definition
'
)
def
step_impl
(
context
):
def
post_credential_def
(
context
):
response
=
post_credential_definition
(
context
.
schema_manager_base_URL
,
context
.
issuer_id
,
context
.
issuer_did
,
context
.
schema_id
)
assert
response
.
status_code
==
201
print
(
response
.
json
()[
"
data
"
][
"
credentialDefinitionId
"
])
context
.
credential_definition_id
=
response
.
json
()[
"
data
"
][
"
credentialDefinitionId
"
]
...
...
@@ -22,35 +22,43 @@ def step_impl(context):
@when
(
u
'
I register a credential definition with a {schema_id}, {issuer_id}, and {issuer_did}
'
)
def
step_impl
(
context
):
if
issuer_id
==
False
:
issuer_id
=
""
else
:
def
step_impl
(
context
,
schema_id
,
issuer_id
,
issuer_did
):
if
issuer_id
==
True
:
issuer_id
=
context
.
issuer_id
if
issuer_did
==
False
:
issuer_did
=
""
else
:
issuer_id
=
""
if
issuer_did
==
True
:
issuer_did
=
context
.
issuer_did
else
:
issuer_did
=
""
if
schema_id
==
Fals
e
:
schema_id
=
""
if
schema_id
==
Tru
e
:
schema_id
=
context
.
schema_id
else
:
schema_id
=
str
(
context
.
schema_id
)
schema_id
=
""
context
.
bad_request_response
=
post_credential_definition
(
context
.
schema_manager_base_URL
,
issuer_id
,
issuer_did
,
schema_id
)
issuer_id
,
issuer_did
,
schema_id
)
@given
(
u
'
I have a credential definition registered
'
)
def
step_impl
(
context
):
raise
NotImplementedError
(
u
'
STEP: Given I have a credential definition registered
'
)
# Goes as far to create a new Schema with tenantDID+ID
post_schema_complete
(
context
)
post_credential_def
(
context
)
@when
(
u
'
I register the same credential definition
'
)
def
step_impl
(
context
):
raise
NotImplementedError
(
u
'
STEP: When I register the same credential definition
'
)
context
.
conflict_response
=
post_credential_definition
(
context
.
schema_manager_base_URL
,
context
.
issuer_id
,
context
.
issuer_did
,
context
.
schema_id
)
@when
(
u
'
I list the credential definition
'
)
...
...
This diff is collapsed.
Click to expand it.
features/steps/init.py
+
7
−
7
View file @
ad9f5bc0
from
behave
import
*
import
requests
import
json
from
helper
import
generate_random_string
,
register_endorser_did
,
create_issuer_tennant
,
register_issuer_did
...
...
@@ -17,11 +15,13 @@ def step_init(context):
context
.
dev_tools_base_URL
=
localhost
+
"
4100
"
context
.
did_manager_base_URL
=
localhost
+
"
4006
"
# context.schema_manager_base_URL_2 = localhost + "4011"
# context.connection_manager_base_URL_2 = localhost + "4012"
# context.dev_tools_base_URL_2 = localhost + "4110"
# context.beta.schema_manager_base_URL = localhost + "4011"
# context.beta.connection_manager_base_URL = localhost + "4012"
# context.beta.credential_manager_base_URL = localhost + "4013"
# context.beta.proof_manager_base_URL = localhost + "4014"
# context.beta.dev_tools_base_URL = localhost + "4110"
# context.beta.did_manager_base_URL = localhost + "4016"
# Register Endorser DID
register_endorser_did
(
context
.
dev_tools_base_URL
)
...
...
This diff is collapsed.
Click to expand it.
features/steps/schema.py
+
1
−
2
View file @
ad9f5bc0
from
behave
import
*
import
requests
import
json
from
helper
import
generate_random_string
,
post_schemas
,
get_schemas
from
init
import
step_init
,
step_register_issuer_did
...
...
@@ -70,7 +69,7 @@ def step_impl(context):
)
@then
(
u
'
I get HTTP status code 409 Conflict.
'
)
def
step_impl
(
context
):
def
error_409
(
context
):
assert
context
.
conflict_response
.
status_code
==
409
@given
(
u
'
I have a schema registered.
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment