-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from wu-wenxiang/master
feat: add API for endpoint & metadata
- Loading branch information
Showing
14 changed files
with
1,925 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
fixtures: | ||
- ConfigFixture | ||
- SampleDataFixture | ||
|
||
defaults: | ||
ssl: False | ||
request_headers: | ||
content-type: application/json | ||
accept: application/json | ||
|
||
vars: | ||
- &username 'gabbi_user' | ||
- &password 'dandelion' | ||
|
||
tests: | ||
- name: create_user | ||
url: /api/v1/users | ||
method: POST | ||
data: | ||
username: *username | ||
password: *password | ||
is_active: true | ||
status: 200 | ||
response_json_paths: | ||
$.username: *username | ||
|
||
- name: user_login | ||
url: /api/v1/login | ||
method: POST | ||
data: | ||
username: *username | ||
password: *password | ||
status: 200 | ||
response_json_paths: | ||
$.token_type: bearer | ||
|
||
- name: create_service_type | ||
url: /api/v1/service_types | ||
method: POST | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
data: | ||
name: "service_type_A" | ||
description: "service_type_A_description" | ||
status: 201 | ||
response_json_paths: | ||
$.name: "service_type_A" | ||
$.description: "service_type_A_description" | ||
|
||
- name: create_service | ||
url: /api/v1/services | ||
method: POST | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
data: | ||
name: "service_A" | ||
type_id: $HISTORY['create_service_type'].$RESPONSE['$.id'] | ||
vendor: "vendor_A" | ||
description: "service_A_description" | ||
status: 201 | ||
response_json_paths: | ||
$.name: "service_A" | ||
$.type_id: $HISTORY['create_service_type'].$RESPONSE['$.id'] | ||
$.vendor: "vendor_A" | ||
$.description: "service_A_description" | ||
|
||
- name: create_endpoint | ||
url: /api/v1/endpoints | ||
method: POST | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
data: | ||
service_id: $HISTORY['create_service'].$RESPONSE['$.id'] | ||
enabled: true | ||
url: "url_A" | ||
status: 201 | ||
response_json_paths: | ||
$.service_id: $HISTORY['create_service'].$RESPONSE['$.id'] | ||
$.enabled: true | ||
$.url: "url_A" | ||
|
||
- name: create_endpoint_metadata | ||
url: /api/v1/endpoint_metadatas | ||
method: POST | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
data: | ||
endpoint_id: $HISTORY['create_endpoint'].$RESPONSE['$.id'] | ||
key: "key_A" | ||
value: "value_A" | ||
status: 201 | ||
response_json_paths: | ||
$.endpoint_id: $HISTORY['create_endpoint'].$RESPONSE['$.id'] | ||
$.key: "key_A" | ||
$.value: "value_A" | ||
|
||
- name: endpoint_metadata_get | ||
url: /api/v1/endpoint_metadatas/$HISTORY['create_endpoint_metadata'].$RESPONSE['$.id'] | ||
method: GET | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 200 | ||
response_json_paths: | ||
$.endpoint_id: $HISTORY['create_endpoint'].$RESPONSE['$.id'] | ||
$.key: "key_A" | ||
$.value: "value_A" | ||
|
||
- name: endpoint_metadata_list | ||
url: /api/v1/endpoint_metadatas | ||
method: GET | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 200 | ||
response_json_paths: | ||
$.total: 1 | ||
$.data[0].endpoint_id: $HISTORY['create_endpoint'].$RESPONSE['$.id'] | ||
$.data[0].key: "key_A" | ||
$.data[0].value: "value_A" | ||
|
||
- name: endpoint_metadata_update | ||
url: /api/v1/endpoint_metadatas/$HISTORY['create_endpoint_metadata'].$RESPONSE['$.id'] | ||
method: PUT | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
data: | ||
endpoint_id: $HISTORY['create_endpoint'].$RESPONSE['$.id'] | ||
key: "key_B" | ||
value: "value_B" | ||
status: 200 | ||
|
||
- name: endpoint_get | ||
url: /api/v1/endpoint_metadatas/$HISTORY['create_endpoint_metadata'].$RESPONSE['$.id'] | ||
method: GET | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 200 | ||
response_json_paths: | ||
$.endpoint_id: $HISTORY['create_endpoint'].$RESPONSE['$.id'] | ||
$.key: "key_B" | ||
$.value: "value_B" | ||
|
||
- name: delete_endpoint_metadata | ||
url: /api/v1/endpoint_metadatas/$HISTORY['create_endpoint_metadata'].$RESPONSE['$.id'] | ||
method: DELETE | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 204 | ||
|
||
- name: delete_endpoint | ||
url: /api/v1/endpoints/$HISTORY['create_endpoint'].$RESPONSE['$.id'] | ||
method: DELETE | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 204 | ||
|
||
- name: delete_service | ||
url: /api/v1/services/$HISTORY['create_service'].$RESPONSE['$.id'] | ||
method: DELETE | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 204 | ||
|
||
- name: delete_service_type | ||
url: /api/v1/service_types/$HISTORY['create_service_type'].$RESPONSE['$.id'] | ||
method: DELETE | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 204 | ||
|
||
- name: delete_user | ||
url: /api/v1/users/$HISTORY['create_user'].$RESPONSE['$.id'] | ||
method: DELETE | ||
request_headers: | ||
Authorization: Bearer $HISTORY['user_login'].$RESPONSE['$.access_token'] | ||
status: 204 |
34 changes: 34 additions & 0 deletions
34
dandelion/alembic/versions/556f61d01468_add_enabled_field_in_endpoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""add enabled field in endpoint | ||
Revision ID: 556f61d01468 | ||
Revises: 94cf9906bb71 | ||
Create Date: 2023-04-12 14:10:58.954762 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import mysql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "556f61d01468" | ||
down_revision = "94cf9906bb71" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column("endpoint", sa.Column("enabled", sa.Boolean(), nullable=False)) | ||
op.drop_index("name", table_name="endpoint") | ||
op.drop_column("endpoint", "version") | ||
op.drop_column("endpoint", "name") | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column("endpoint", sa.Column("name", mysql.VARCHAR(length=64), nullable=False)) | ||
op.add_column("endpoint", sa.Column("version", mysql.VARCHAR(length=64), nullable=True)) | ||
op.create_index("name", "endpoint", ["name"], unique=False) | ||
op.drop_column("endpoint", "enabled") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.