diff --git a/CHANGES/2083.misc b/CHANGES/2083.misc new file mode 100644 index 000000000..b938fabd6 --- /dev/null +++ b/CHANGES/2083.misc @@ -0,0 +1 @@ +Rewrote functional test suite without pulp-smash. diff --git a/functest_requirements.txt b/functest_requirements.txt index 73e70ba5e..630b79d16 100644 --- a/functest_requirements.txt +++ b/functest_requirements.txt @@ -7,6 +7,3 @@ requests proxy.py~=2.4.9 trustme~=1.2.0 pytest-timeout - -# Legacy: -pulp-smash @ git+https://github.com/pulp/pulp-smash.git diff --git a/pulp_ansible/tests/functional/api/test_rbac.py b/pulp_ansible/tests/functional/api/test_rbac.py index f71acb6a9..89a5737d4 100644 --- a/pulp_ansible/tests/functional/api/test_rbac.py +++ b/pulp_ansible/tests/functional/api/test_rbac.py @@ -1,11 +1,10 @@ import pytest import uuid -from pulp_ansible.tests.functional.constants import ANSIBLE_GALAXY_URL -from pulp_ansible.tests.functional.utils import gen_ansible_remote - from pulpcore.client.pulp_ansible import ApiException, AsyncOperationResponse +from pulp_ansible.tests.functional.constants import ANSIBLE_GALAXY_URL + # TODO Find a way to make the factories work with try_action def gen_repo(): @@ -16,6 +15,10 @@ def gen_distribution(): return {"name": str(uuid.uuid4()), "base_path": str(uuid.uuid4())} +def gen_remote(): + return {"name": str(uuid.uuid4()), "url": ANSIBLE_GALAXY_URL, "rate_limit": 5} + + @pytest.fixture() def gen_users(gen_user): """Returns a user generator function for the tests.""" @@ -501,21 +504,21 @@ def test_remotes_rbac( remote_api, "create", 201, - gen_ansible_remote(url=ANSIBLE_GALAXY_URL), + gen_remote(), ) try_action( user_reader, remote_api, "create", 403, - gen_ansible_remote(url=ANSIBLE_GALAXY_URL), + gen_remote(), ) try_action( user_helpless, remote_api, "create", 403, - gen_ansible_remote(url=ANSIBLE_GALAXY_URL), + gen_remote(), ) # View testing @@ -524,7 +527,7 @@ def test_remotes_rbac( try_action(user_helpless, remote_api, "read", 404, remote.pulp_href) # Update testing - update_args = [remote.pulp_href, gen_ansible_remote(url=ANSIBLE_GALAXY_URL)] + update_args = [remote.pulp_href, gen_remote()] try_action(user_creator, remote_api, "update", 202, *update_args) try_action(user_reader, remote_api, "update", 403, *update_args) try_action(user_helpless, remote_api, "update", 404, *update_args) @@ -564,7 +567,7 @@ def test_remotes_role_management( remote_api, "create", 201, - gen_ansible_remote(url=ANSIBLE_GALAXY_URL), + gen_remote(), ) href = remote.pulp_href diff --git a/pulp_ansible/tests/functional/utils.py b/pulp_ansible/tests/functional/utils.py index 2bf7ed5ca..446d7f132 100644 --- a/pulp_ansible/tests/functional/utils.py +++ b/pulp_ansible/tests/functional/utils.py @@ -4,18 +4,6 @@ import string from urllib.parse import urlparse, parse_qs -from pulp_smash import config -from pulp_smash.pulp3.utils import ( - gen_remote, -) - -from pulp_ansible.tests.functional.constants import ( - ANSIBLE_FIXTURE_URL, -) - - -cfg = config.get_config() - def randstr(): return "".join(random.choices(string.ascii_lowercase, k=8)) @@ -26,21 +14,6 @@ def content_counts(repository_version, summary_type="present"): return {key: value["count"] for key, value in content_summary.items()} -def gen_ansible_remote(url=ANSIBLE_FIXTURE_URL, include_pulp_auth=False, **kwargs): - """Return a semi-random dict for use in creating a ansible Remote. - - :param url: The URL of an external content source. - """ - if include_pulp_auth: - kwargs["username"] = cfg.pulp_auth[0] - kwargs["password"] = cfg.pulp_auth[1] - - if "rate_limit" not in kwargs: - kwargs["rate_limit"] = 5 - - return gen_remote(url, **kwargs) - - def iterate_all(list_func, **kwargs): """ Iterate through all of the items on every page in a paginated list view.