Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Fix google test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
F-X64 committed Oct 17, 2022
1 parent bc62eb1 commit abf93bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
]

MOCKED_GCP_IMAGE_LIST = [
{"status": "READY"},
{"status": "DEPRECATED"},
"rhel-7-v20220920",
"rhel-8-v20220920",
"rhel-9-arm64-v20220920",
"rhel-9-v20220920",
]


Expand Down Expand Up @@ -65,4 +67,4 @@ def mock_gcp_images(mocker):
"""Provide an offline result for calls to get_google_images."""
mock = mocker.patch("rhelocator.update_images.get_google_images")
mock.return_value = MOCKED_GCP_IMAGE_LIST
return mock
return mock
10 changes: 7 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_aws_regions_offline(mock_aws_regions, runner):
assert "us-east-1" in parsed
assert result.exit_code == 0


@pytest.mark.e2e
def test_azure_images_live(runner):
"""Run a live test against the Azure API to get images via CLI."""
Expand Down Expand Up @@ -115,6 +116,7 @@ def test_azure_images_offline(mock_azure_image_versions, runner):

assert result.exit_code == 0


@pytest.mark.e2e
def test_gcp_images_live(runner):
"""Run a live test against the Google Cloud API to get images via CLI."""
Expand All @@ -123,7 +125,8 @@ def test_gcp_images_live(runner):

assert isinstance(parsed, list)

assert {image["status"] for image in parsed} != "DEPRECATED"
for image in parsed:
assert image.startswith("rhel")

assert result.exit_code == 0

Expand All @@ -135,6 +138,7 @@ def test_gcp_images_offline(mock_gcp_images, runner):

assert isinstance(parsed, list)

assert {image["status"] for image in parsed} != "DEPRECATED"
for image in parsed:
assert image.startswith("rhel")

assert result.exit_code == 0
assert result.exit_code == 0

0 comments on commit abf93bb

Please sign in to comment.