Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions flake8.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
exclude = ./docs/*,*/migrations/*
ignore = W503,Q000,D100,D104,D106,D200,D401,D402,D202
ignore = W503,Q000,D100,D104,D106,D200,D401,D402
max-line-length = 100

# Flake8-quotes extension codes
Expand All @@ -14,6 +14,5 @@ max-line-length = 100
# D104: missing docstring in public package
# D106: missing docstring in public nested class (complains about "class Meta:" and documenting those is silly)
# D200: one-line docstring should fit on one line with quotes
# D202: no blank line after docstring--disabled until https://github.com/PyCQA/pydocstyle/issues/361 is fixed
# D401: first line should be imperative (nitpicky)
# D402: first line should not be the function’s “signature” (false positives)
1 change: 0 additions & 1 deletion pulp_ansible/app/galaxy/v3/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def _get_errors(detail, *, status, title, source=None):

def exception_handler(exc, context):
"""Custom exception handler."""

if isinstance(exc, Http404):
exc = exceptions.NotFound()
elif isinstance(exc, PermissionDenied):
Expand Down
1 change: 0 additions & 1 deletion pulp_ansible/app/tasks/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def import_collection(
match the metadata in the tarball.

"""

CollectionImport.objects.get_or_create(task_id=get_current_job().id)

artifact = Artifact.objects.get(pk=artifact_pk)
Expand Down
15 changes: 0 additions & 15 deletions pulp_ansible/tests/functional/api/collection/v3/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

def upload_handler(client, response):
"""Handle responses to collection upload by fetching and returning the task data."""

response.raise_for_status()
logger.debug("response status: %s", response.status_code)
if response.status_code == 204:
Expand All @@ -49,7 +48,6 @@ def get_galaxy_url(base, path):

Takes the expected GALAXY_API_ROOT setting of the target into consideration.
"""

cfg = config.get_config()
path = path.lstrip("/")
GALAXY_API_ROOT = cfg.custom.get(
Expand All @@ -61,15 +59,13 @@ def get_galaxy_url(base, path):
@pytest.fixture(scope="session")
def artifact():
"""Generate a randomized collection for testing."""

artifact = build_collection("skeleton")
return artifact


@pytest.fixture(scope="session")
def collection_upload(pulp_client, artifact, pulp_dist):
"""Publish a new collection and return the processed response data."""

UPLOAD_PATH = get_galaxy_url(pulp_dist["base_path"], "/v3/artifacts/collections/")

logging.info(f"Uploading collection to '{UPLOAD_PATH}'...")
Expand All @@ -82,7 +78,6 @@ def collection_upload(pulp_client, artifact, pulp_dist):
@pytest.fixture(scope="session")
def collection_detail(collection_upload, pulp_client, pulp_dist, artifact):
"""Fetch and parse a collection details response from an uploaded collection."""

url = get_galaxy_url(
pulp_dist["base_path"], f"/v3/collections/{artifact.namespace}/{artifact.name}/"
)
Expand All @@ -93,7 +88,6 @@ def collection_detail(collection_upload, pulp_client, pulp_dist, artifact):
@pytest.fixture(scope="session")
def pulp_client():
"""Create and configure a Pulp API client, including custom authentication headers."""

cfg = config.get_config()
client = api.Client(cfg)
headers = cfg.custom.get("headers", None)
Expand All @@ -105,7 +99,6 @@ def pulp_client():
@pytest.fixture(scope="session")
def pulp_repo(pulp_client):
"""Find or create a Repository to attach to the Ansible Distribution we create."""

repos = pulp_client.get(ANSIBLE_REPO_PATH)
if repos:
yield repos[0]
Expand All @@ -119,7 +112,6 @@ def pulp_repo(pulp_client):
@pytest.fixture(scope="session")
def pulp_dist(pulp_client, pulp_repo):
"""Create an Ansible Distribution to simulate the automation hub environment for testing."""

dists = pulp_client.get(ANSIBLE_DISTRIBUTION_PATH + "?base_path=automation-hub")

if len(dists) == 0:
Expand All @@ -141,7 +133,6 @@ def pulp_dist(pulp_client, pulp_repo):
@pytest.fixture(scope="session")
def known_collection():
"""Fetch and prepare a known collection from Galaxy to use in an upload test."""

collection_content = http_get(ANSIBLE_COLLECTION_UPLOAD_FIXTURE_URL)
collection = {"file": (ANSIBLE_COLLECTION_FILE_NAME, collection_content)}
return collection
Expand All @@ -152,7 +143,6 @@ def test_collection_upload(collection_upload):

Uploads a newly generated collection and validates the resulting collection version details.
"""

# Validate the upload response
assert collection_upload["error"] is None
assert re.match(
Expand Down Expand Up @@ -181,7 +171,6 @@ def test_collection_detail(artifact, collection_detail, pulp_dist):

Includes information of the most current version.
"""

url = get_galaxy_url(
pulp_dist["base_path"], f"/v3/collections/{artifact.namespace}/{artifact.name}/"
)
Expand All @@ -199,7 +188,6 @@ def test_collection_detail(artifact, collection_detail, pulp_dist):

def test_collection_version_list(artifact, pulp_client, collection_detail):
"""Test the versions endpoint, listing the available versions of a given collection."""

# Version List Endpoint
versions = pulp_client.using_handler(api.json_handler).get(collection_detail["versions_url"])
assert versions["count"] == 1
Expand All @@ -215,7 +203,6 @@ def test_collection_version(artifact, pulp_client, collection_detail):

Each collection version details a specific uploaded artifact for the collection.
"""

# Version Endpoint
version = pulp_client.using_handler(api.json_handler).get(
collection_detail["highest_version"]["href"]
Expand Down Expand Up @@ -254,7 +241,6 @@ def test_collection_download(artifact, pulp_client, collection_detail):

Should require authentication and redirect to a download location.
"""

version = pulp_client.using_handler(api.json_handler).get(
collection_detail["highest_version"]["href"]
)
Expand All @@ -275,7 +261,6 @@ def test_collection_upload_repeat(pulp_client, known_collection, pulp_dist):

Should fail, because of the conflict of collection name and version.
"""

cfg = config.get_config()
url = urljoin(cfg.get_base_url(), f"api/{pulp_dist['base_path']}/v3/artifacts/collections/")

Expand Down