Skip to content

Commit

Permalink
[UNIT-TEST]: Webhook Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Jan 7, 2025
1 parent cb36da3 commit 34aab1e
Show file tree
Hide file tree
Showing 6 changed files with 490 additions and 11 deletions.
8 changes: 4 additions & 4 deletions jac-cloud/jac_cloud/jaseci/models/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@dataclass(kw_only=True)
class Webhook:
"""User Base Model."""
"""Webhook Base Model."""

id: ObjectId = field(default_factory=ObjectId)
name: str
Expand All @@ -23,9 +23,9 @@ class Webhook:

class Collection(BaseCollection["Webhook"]):
"""
User collection interface.
Webhook collection interface.
This interface is for User's Management.
This interface is for Webhook Credentials Management.
You may override this if you wish to implement different structure
"""

Expand All @@ -40,7 +40,7 @@ def __document__(cls, doc: Mapping[str, Any]) -> "Webhook":
"""
Return parsed Webhook from document.
This the default User parser after getting a single document.
This the default Webhook parser after getting a single document.
You may override this to specify how/which class it will be casted/based.
"""
doc = cast(dict, doc)
Expand Down
309 changes: 305 additions & 4 deletions jac-cloud/jac_cloud/tests/openapi_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,11 @@ components:
securitySchemes:
APIKeyHeader:
in: header
name: X-API-KEY
name: test_key
type: apiKey
APIKeyQuery:
in: query
name: test_key
type: apiKey
HTTPBearer:
scheme: bearer
Expand Down Expand Up @@ -4069,7 +4073,6 @@ paths:
summary: /visit_nested_node/{node}
tags:
- walker
- walker
/walker/visit_sequence:
post:
operationId: api_root_walker_visit_sequence_post
Expand All @@ -4086,7 +4089,6 @@ paths:
summary: /visit_sequence
tags:
- walker
- walker
/walker/visit_sequence/{node}:
post:
operationId: api_entry_walker_visit_sequence__node__post
Expand Down Expand Up @@ -4118,4 +4120,303 @@ paths:
summary: /visit_sequence/{node}
tags:
- walker
- walker
/webhook:
get:
description: Get keys API.
operationId: get_webhook_get
responses:
'200':
content:
application/json:
schema: {}
description: Successful Response
security:
- HTTPBearer: []
summary: Get
tags:
- webhook
/webhook/delete:
delete:
description: Delete keys API.
operationId: delete_webhook_delete_delete
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/KeyIDs'
required: true
responses:
'200':
content:
application/json:
schema: {}
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
security:
- HTTPBearer: []
summary: Delete
tags:
- webhook
/webhook/extend/{id}:
patch:
description: Generate key API.
operationId: extend_webhook_extend__id__patch
parameters:
- in: path
name: id
required: true
schema:
title: Id
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Expiration'
required: true
responses:
'201':
content:
application/json:
schema: {}
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
security:
- HTTPBearer: []
summary: Extend
tags:
- webhook
/webhook/generate-key:
post:
description: Generate key API.
operationId: generate_key_webhook_generate_key_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GenerateKey'
required: true
responses:
'201':
content:
application/json:
schema: {}
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
security:
- HTTPBearer: []
summary: Generate Key
tags:
- webhook
/webhook/walker/webhook_by_body:
post:
operationId: api_root_webhook_walker_webhook_by_body_post
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Root Webhook Walker Webhook By Body Post
description: Successful Response
summary: /webhook_by_body
tags:
- webhook-walker
/webhook/walker/webhook_by_body/{node}:
post:
operationId: api_entry_webhook_walker_webhook_by_body__node__post
parameters:
- in: path
name: node
required: true
schema:
anyOf:
- type: string
- type: 'null'
title: Node
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Entry Webhook Walker Webhook By Body Node Post
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
summary: /webhook_by_body/{node}
tags:
- webhook-walker
/webhook/walker/webhook_by_header:
post:
operationId: api_root_webhook_walker_webhook_by_header_post
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Root Webhook Walker Webhook By Header Post
description: Successful Response
security:
- APIKeyHeader: []
summary: /webhook_by_header
tags:
- webhook-walker
/webhook/walker/webhook_by_header/{node}:
post:
operationId: api_entry_webhook_walker_webhook_by_header__node__post
parameters:
- in: path
name: node
required: true
schema:
anyOf:
- type: string
- type: 'null'
title: Node
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Entry Webhook Walker Webhook By Header Node Post
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
security:
- APIKeyHeader: []
summary: /webhook_by_header/{node}
tags:
- webhook-walker
/webhook/walker/webhook_by_path/{node}/{test_key}:
post:
operationId: api_entry_webhook_walker_webhook_by_path__node___test_key__post
parameters:
- in: path
name: node
required: true
schema:
anyOf:
- type: string
- type: 'null'
title: Node
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Entry Webhook Walker Webhook By Path Node Test
Key Post
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
summary: /webhook_by_path/{node}/{test_key}
tags:
- webhook-walker
/webhook/walker/webhook_by_path/{test_key}:
post:
operationId: api_root_webhook_walker_webhook_by_path__test_key__post
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Root Webhook Walker Webhook By Path Test Key Post
description: Successful Response
summary: /webhook_by_path/{test_key}
tags:
- webhook-walker
/webhook/walker/webhook_by_query:
post:
operationId: api_root_webhook_walker_webhook_by_query_post
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Root Webhook Walker Webhook By Query Post
description: Successful Response
security:
- APIKeyQuery: []
summary: /webhook_by_query
tags:
- webhook-walker
/webhook/walker/webhook_by_query/{node}:
post:
operationId: api_entry_webhook_walker_webhook_by_query__node__post
parameters:
- in: path
name: node
required: true
schema:
anyOf:
- type: string
- type: 'null'
title: Node
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ContextResponse_NoneType_'
- {}
title: Response Api Entry Webhook Walker Webhook By Query Node Post
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
security:
- APIKeyQuery: []
summary: /webhook_by_query/{node}
tags:
- webhook-walker
Loading

0 comments on commit 34aab1e

Please sign in to comment.