Skip to content

Commit

Permalink
Remove pulp-smash from functional test suite
Browse files Browse the repository at this point in the history
fixes #2083
  • Loading branch information
mdellweg committed Feb 4, 2025
1 parent 609fa17 commit 84a3271
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGES/2083.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rewrote functional test suite without pulp-smash.
3 changes: 0 additions & 3 deletions functest_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 11 additions & 8 deletions pulp_ansible/tests/functional/api/test_rbac.py
Original file line number Diff line number Diff line change
@@ -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():
Expand All @@ -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."""
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down
27 changes: 0 additions & 27 deletions pulp_ansible/tests/functional/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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.
Expand Down

0 comments on commit 84a3271

Please sign in to comment.