mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-09 12:10:08 +01:00
95c0c259ec
This commit creates a new E2E API test case to verify the replication based on label Signed-off-by: Wenkai Yin <yinw@vmware.com>
27 lines
912 B
Python
27 lines
912 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import sys
|
|
import base
|
|
import swagger_client
|
|
|
|
class Repository(base.Base):
|
|
def list_tags(self, repository, **kwargs):
|
|
client = self._get_client(**kwargs)
|
|
return client.repositories_repo_name_tags_get(repository)
|
|
|
|
def image_exists(self, repository, tag, **kwargs):
|
|
tags = self.list_tags(repository, **kwargs)
|
|
exist = False
|
|
for t in tags:
|
|
if t.name == tag:
|
|
exist = True
|
|
break
|
|
return exist
|
|
|
|
def image_should_exist(self, repository, tag, **kwargs):
|
|
if not self.image_exists(repository, tag, **kwargs):
|
|
raise Exception("image %s:%s not exist" % (repository, tag))
|
|
|
|
def image_should_not_exist(self, repository, tag, **kwargs):
|
|
if self.image_exists(repository, tag, **kwargs):
|
|
raise Exception("image %s:%s exists" % (repository, tag)) |