Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
Issue: AAH-906
  • Loading branch information
bmclaughlin committed Oct 21, 2021
1 parent ed91ad1 commit f8b32a5
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions galaxy_ng/tests/functional/cli/test_container_repository_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,17 @@ class ContainerRepositoryTagsTestCase(TestCaseUsingBindings):
"""Test whether a container repository's tags can be listed."""

@staticmethod
def login_to_registry(
container_engine="podman",
user="admin",
password="admin",
registry="localhost:5001"
):
def login_to_registry(container_engine, registry):
cmd = [
container_engine,
"login", "-u", user, "-p", password,
"login", "-u", "admin", "-p", "admin",
"--tls-verify=false",
registry
]
run(cmd)

@staticmethod
def create_container_repository(
image,
registry,
container_engine="podman",
tag="latest",
):
def create_container_repository(container_engine, registry, image, tag):
pull_registry = "registry.access.redhat.com"

# Pull images, record image id for cleanup
Expand All @@ -53,23 +43,30 @@ def create_container_repository(
return image_id

def test_list_container_repository_tags(self):
self.login_to_registry()
registry = f"{self.cfg.get_base_url().lstrip('http://')}"
container_engine = "podman"

self.login_to_registry(container_engine, registry)

image_ids = []
image = "ubi8"
tags = ["8.1", "8.2"]
for tag in tags:
image_id = self.create_container_repository(
container_engine=container_engine,
image=image,
registry="localhost:5001",
registry=registry,
tag=tag)
image_ids.append(image_id)

response = self.container_repo_tags_api.list(base_path=image)
# response = self.container_repo_tags_api.list(base_path=image) works in dev env
response = self.smash_client.get(
f"{self.galaxy_api_prefix}/_ui/v1/execution-environments/repositories/{image}/_content/tags/"
)

self.assertEqual(response.meta.count, len(tags))
for entry in response.data:
self.assertIn(entry.name, tags)
self.assertEqual(response["meta"]["count"], len(tags))
for entry in response["data"]:
self.assertIn(entry["name"], tags)

# Delete downloaded images
for image_id in image_ids:
Expand Down

0 comments on commit f8b32a5

Please sign in to comment.