Skip to content

Commit

Permalink
admin users in test_artifact_upload.py (ansible#2199)
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian authored Jul 23, 2024
1 parent 4287ded commit 8619614
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions galaxy_ng/tests/integration/api/test_artifact_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_validated_publish(ansible_config, artifact, galaxy_client):
@pytest.mark.all
def test_api_publish_bad_hash(ansible_config, artifact, upload_artifact):
"""Test error responses when posting to the collections endpoint."""
config = ansible_config("basic_user")
config = ansible_config("admin")
api_client = get_client(config)

with pytest.raises(CapturingGalaxyError) as excinfo:
Expand All @@ -138,7 +138,7 @@ def test_api_publish_bad_hash(ansible_config, artifact, upload_artifact):
@pytest.mark.all
def test_api_publish_invalid_tarball(artifact, galaxy_client):
"""Test error responses when uploading a file that is not a tarball."""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

with open(artifact.filename, "wb") as f:
f.write(randstr(1024).encode("utf8"))
Expand All @@ -151,7 +151,7 @@ def test_api_publish_invalid_tarball(artifact, galaxy_client):

def test_api_publish_missing_filename(galaxy_client, artifact):
"""Test handling of uploads missing the filename parameter."""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

with pytest.raises(GalaxyClientError) as excinfo:
with patch("ansible.galaxy.api.GalaxyError", CapturingGalaxyError):
Expand All @@ -169,7 +169,7 @@ def test_api_publish_missing_filename(galaxy_client, artifact):
@pytest.mark.all
def test_api_publish_broken_manifest(artifact, galaxy_client):
"""Test handling of uploads missing the collection name parameter."""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

with modify_artifact(artifact) as artifact_dir:
manifest_path = os.path.join(artifact_dir, "MANIFEST.json")
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_api_publish_broken_manifest(artifact, galaxy_client):
@pytest.mark.all
def test_api_publish_invalid_filename(galaxy_client, artifact, wrong_name):
"""Test handling of uploads with invalid filenames."""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

# use the param lambda function to alter the tarball filename ...
wrong_name = INVALID_NAMES[wrong_name](os.path.basename(artifact.filename))
Expand All @@ -221,7 +221,7 @@ def test_api_publish_invalid_filename(galaxy_client, artifact, wrong_name):

def test_api_publish_missing_file(galaxy_client, artifact):
"""Test handling of POSTs to the artifact endpoint neglecting to submit a file."""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")
with pytest.raises(GalaxyClientError) as excinfo:
with patch("ansible.galaxy.api.GalaxyError", GalaxyClientError):
upload_artifact(None, gc, artifact, no_file=True)
Expand Down Expand Up @@ -262,7 +262,7 @@ def test_api_publish_missing_file(galaxy_client, artifact):
@pytest.mark.all
def test_long_field_values(galaxy_client, field):
"""Test handling of POSTs to the artifact endpoint neglecting to submit a file."""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")
fieldname, fieldvalue, fieldmax = field
artifact = build_collection(
"skeleton", config={"namespace": USERNAME_PUBLISHER, fieldname: fieldvalue}
Expand Down Expand Up @@ -344,7 +344,7 @@ def test_ansible_lint_exception(galaxy_client, hub_version):
* ansible-lint runs against our uploaded collection
* the bug in https://github.com/ansible/galaxy-importer/pull/115 remains fixed.
"""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

broken_role_yaml = [{"name": "a task", "not.a.real.module": {"fake": "fake"}}]

Expand Down Expand Up @@ -387,7 +387,7 @@ def test_ansible_lint_exception_AAH_2606(galaxy_client, hub_version):
https://issues.redhat.com/browse/AAH-2609
- ansible-lint output is missing.
"""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

IGNORE_CONTENT = \
"plugins/modules/lm_otel_collector.py validate-modules:use-run-command-not-popen\n"
Expand Down Expand Up @@ -450,7 +450,7 @@ def test_api_publish_log_missing_ee_deps(galaxy_client):
In this case a requirements.txt file exists but bindep.txt does not.
"""

gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

artifact = build_collection(
"skeleton",
Expand Down Expand Up @@ -488,7 +488,7 @@ def test_api_publish_ignore_files_logged(galaxy_client):
"""
Test that galaxy-importer logs when ansible-test sanity ignore files are present.
"""
gc = galaxy_client("basic_user")
gc = galaxy_client("admin")

artifact = build_collection(
"skeleton",
Expand Down

0 comments on commit 8619614

Please sign in to comment.