fix(immutability) swagger test case

Signed-off-by: Ziming Zhang <zziming@vmware.com>
This commit is contained in:
Ziming Zhang 2021-01-08 22:28:19 +08:00 committed by Ziming
parent be58c1d3ff
commit 5bff3e94a0
3 changed files with 51 additions and 7 deletions

View File

@ -2234,7 +2234,7 @@ paths:
schema: schema:
type: array type: array
items: items:
$ref: '#/definitions/RetentionRule' $ref: '#/definitions/ImmutableRule'
'400': '400':
description: Illegal format of provided ID value. description: Illegal format of provided ID value.
'401': '401':
@ -2254,11 +2254,11 @@ paths:
format: int64 format: int64
required: true required: true
description: Relevant project ID. description: Relevant project ID.
- name: RetentionRule - name: ImmutableRule
in: body in: body
required: true required: true
schema: schema:
$ref: '#/definitions/RetentionRule' $ref: '#/definitions/ImmutableRule'
tags: tags:
- Products - Products
responses: responses:
@ -2288,11 +2288,11 @@ paths:
format: int64 format: int64
required: true required: true
description: Immutable tag rule ID. description: Immutable tag rule ID.
- name: RetentionRule - name: ImmutableRule
in: body in: body
required: true required: true
schema: schema:
$ref: '#/definitions/RetentionRule' $ref: '#/definitions/ImmutableRule'
tags: tags:
- Products - Products
responses: responses:
@ -4189,6 +4189,46 @@ definitions:
type: string type: string
description: Webhook supportted notify type. description: Webhook supportted notify type.
example: 'http' example: 'http'
ImmutableRule:
type: object
properties:
id:
type: integer
priority:
type: integer
disabled:
type: boolean
action:
type: string
template:
type: string
params:
type: object
additionalProperties:
type: object
tag_selectors:
type: array
items:
$ref: '#/definitions/ImmutableSelector'
scope_selectors:
type: object
additionalProperties:
type: array
items:
$ref: '#/definitions/ImmutableSelector'
ImmutableSelector:
type: object
properties:
kind:
type: string
decoration:
type: string
pattern:
type: string
extras:
type: string
parameters: parameters:
query: query:
name: q name: q

View File

@ -10,7 +10,7 @@ class Tag_Immutability(base.Base):
selector_tag="**", expect_status_code = 201, **kwargs): selector_tag="**", expect_status_code = 201, **kwargs):
#repoExcludes,excludes #repoExcludes,excludes
client = self._get_client(**kwargs) client = self._get_client(**kwargs)
retention_rule = swagger_client.RetentionRule( immutable_rule = swagger_client.ImmutableRule(
action="immutable", action="immutable",
template="immutable_template", template="immutable_template",
priority = 0, priority = 0,
@ -32,7 +32,7 @@ class Tag_Immutability(base.Base):
] ]
) )
try: try:
_, status_code, header = client.projects_project_id_immutabletagrules_post_with_http_info(project_id, retention_rule) _, status_code, header = client.projects_project_id_immutabletagrules_post_with_http_info(project_id, immutable_rule)
except ApiException as e: except ApiException as e:
base._assert_status_code(expect_status_code, e.status) base._assert_status_code(expect_status_code, e.status)
else: else:

View File

@ -149,6 +149,10 @@ Test Case - Proxy Cache
[Tags] proxy_cache [Tags] proxy_cache
Harbor API Test ./tests/apitests/python/test_proxy_cache.py Harbor API Test ./tests/apitests/python/test_proxy_cache.py
Test Case - Tag Immutability
[Tags] tag_immutability
Harbor API Test ./tests/apitests/python/test_tag_immutability.py
Test Case - P2P Test Case - P2P
[Tags] p2p [Tags] p2p
Harbor API Test ./tests/apitests/python/test_p2p.py Harbor API Test ./tests/apitests/python/test_p2p.py