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:
type: array
items:
$ref: '#/definitions/RetentionRule'
$ref: '#/definitions/ImmutableRule'
'400':
description: Illegal format of provided ID value.
'401':
@ -2254,11 +2254,11 @@ paths:
format: int64
required: true
description: Relevant project ID.
- name: RetentionRule
- name: ImmutableRule
in: body
required: true
schema:
$ref: '#/definitions/RetentionRule'
$ref: '#/definitions/ImmutableRule'
tags:
- Products
responses:
@ -2288,11 +2288,11 @@ paths:
format: int64
required: true
description: Immutable tag rule ID.
- name: RetentionRule
- name: ImmutableRule
in: body
required: true
schema:
$ref: '#/definitions/RetentionRule'
$ref: '#/definitions/ImmutableRule'
tags:
- Products
responses:
@ -4189,6 +4189,46 @@ definitions:
type: string
description: Webhook supportted notify type.
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:
query:
name: q

View File

@ -10,7 +10,7 @@ class Tag_Immutability(base.Base):
selector_tag="**", expect_status_code = 201, **kwargs):
#repoExcludes,excludes
client = self._get_client(**kwargs)
retention_rule = swagger_client.RetentionRule(
immutable_rule = swagger_client.ImmutableRule(
action="immutable",
template="immutable_template",
priority = 0,
@ -32,7 +32,7 @@ class Tag_Immutability(base.Base):
]
)
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:
base._assert_status_code(expect_status_code, e.status)
else:

View File

@ -149,6 +149,10 @@ Test Case - Proxy Cache
[Tags] proxy_cache
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
[Tags] p2p
Harbor API Test ./tests/apitests/python/test_p2p.py