Review requests

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/84159/head
Abhijeet Kasurde 1 week ago
parent 5c8fd21d16
commit bdccccfcee

@ -29,6 +29,5 @@ def test_extract_tar_dir_exists(mocker, fake_tar_obj, isdir, called, call_args):
_extract_tar_dir(fake_tar_obj, '/some/dir', b'/some/dest')
assert m_makedir.called == called
if m_makedir.called:
assert m_makedir.call_args[0] == call_args
assert m_makedir.called is called
assert not called or m_makedir.call_args[0] == call_args

@ -19,7 +19,7 @@ def collection_object():
@pytest.mark.parametrize(
("kwargs", "expected"),
("display_collection_keyword_args", "expected"),
[
pytest.param(
{},
@ -43,7 +43,7 @@ def collection_object():
),
],
)
def test_display_collection(capsys, kwargs, expected, collection_object):
_display_collection(collection_object(), **kwargs)
def test_display_collection(capsys, display_collection_keyword_args, expected, collection_object):
_display_collection(collection_object(), **display_collection_keyword_args)
out, dummy = capsys.readouterr()
assert out == expected

@ -10,7 +10,7 @@ import pytest
@pytest.mark.parametrize(
("test", "expected"),
("role_metadata", "expected"),
[
pytest.param(
{"name": "testrole", "install_info": None},
@ -24,9 +24,9 @@ import pytest
),
],
)
def test_display_role(mocker, capsys, test, expected):
mocked_galaxy_role = mocker.Mock(**test)
mocked_galaxy_role.name = test["name"]
def test_display_role(mocker, capsys, role_metadata, expected):
mocked_galaxy_role = mocker.Mock(**role_metadata)
mocked_galaxy_role.name = role_metadata["name"]
_display_role(mocked_galaxy_role)
out, dummy = capsys.readouterr()
out_lines = out.splitlines()

@ -11,17 +11,17 @@ from ansible.cli.galaxy import GalaxyCLI
@pytest.mark.parametrize(
("test_type", "expected"),
("installable_content_type", "expected"),
[
pytest.param("role", (1, 0), id="list-role-called"),
pytest.param("collection", (0, 1), id="list-collection-called"),
],
)
def test_execute_list(mocker, test_type, expected):
def test_execute_list(mocker, installable_content_type, expected):
"""Make sure the correct method is called for a role"""
gc = GalaxyCLI(["ansible-galaxy", test_type, "list"])
context.CLIARGS._store = {"type": test_type}
gc = GalaxyCLI(["ansible-galaxy", installable_content_type, "list"])
context.CLIARGS._store = {"type": installable_content_type}
execute_list_role_mock = mocker.patch(
"ansible.cli.galaxy.GalaxyCLI.execute_list_role",
side_effect=AttributeError("raised intentionally"),

Loading…
Cancel
Save