Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian committed Mar 3, 2024
1 parent a4cae83 commit f0a08fb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions galaxy_ng/tests/integration/api/test_aiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def namespace(ansible_config, galaxy_client) -> str:


@pytest.fixture(scope="function")
def pe_namespace(ansible_config) -> str:
def pe_namespace(ansible_config, galaxy_client) -> str:
"""create a new namespace owned by PE user."""
config = ansible_config("partner_engineer")
api_client = get_client(config, request_token=True, require_auth=True)
new_namespace = generate_unused_namespace(api_client=api_client, api_version="_ui/v1")
gc = galaxy_client("partner_engineer")
new_namespace = generate_unused_namespace(gc=gc, api_version="_ui/v1")
with UIClient(config=config) as uclient:
# get user
resp = uclient.get("_ui/v1/me/")
Expand Down
16 changes: 8 additions & 8 deletions galaxy_ng/tests/integration/api/test_upload_to_custom_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,23 @@ def test_publish_to_custom_staging_repo(ansible_config, artifact, settings, gala

@pytest.mark.deployment_community
@pytest.mark.min_hub_version("4.7dev")
def test_publish_to_custom_repo(ansible_config, artifact, settings):
def test_publish_to_custom_repo(ansible_config, artifact, settings, galaxy_client):
config = ansible_config(profile="admin")
client = get_client(
config=config
)

repo = AnsibleDistroAndRepo(
client,
f"repo-test-{generate_random_string()}",
)

_upload_test_common(config, client, artifact, repo.get_distro()["base_path"])
gc = galaxy_client("admin")
_upload_test_common(config, None, artifact, repo.get_distro()["base_path"], gc=gc)


@pytest.mark.deployment_community
@pytest.mark.auto_approve
@pytest.mark.min_hub_version("4.7dev")
def test_publish_and_auto_approve(ansible_config, artifact, settings):
def test_publish_and_auto_approve(ansible_config, artifact, settings, galaxy_client):
if settings.get("GALAXY_REQUIRE_CONTENT_APPROVAL"):
pytest.skip("GALAXY_REQUIRE_CONTENT_APPROVAL must be false")
config = ansible_config(profile="admin")
Expand All @@ -122,8 +121,9 @@ def test_publish_and_auto_approve(ansible_config, artifact, settings):
client,
f"repo-test-{generate_random_string()}",
)

_upload_test_common(config, client, artifact, repo.get_distro()["base_path"], "published")
gc = galaxy_client("admin")
_upload_test_common(config, None, artifact, repo.get_distro()["base_path"],
"published", gc=gc)

cv = client(
f"{api_prefix}content/published/v3/collections/"
Expand All @@ -136,7 +136,7 @@ def test_publish_and_auto_approve(ansible_config, artifact, settings):
@pytest.mark.deployment_community
@pytest.mark.auto_approve
@pytest.mark.min_hub_version("4.7dev")
def test_auto_approve_muliple(ansible_config, artifact, settings):
def test_auto_approve_multiple(ansible_config, artifact, settings):
if settings.get("GALAXY_REQUIRE_CONTENT_APPROVAL"):
pytest.skip("GALAXY_REQUIRE_CONTENT_APPROVAL must be false")
config = ansible_config(profile="admin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_legacy_role_download_counter_via_cli(ansible_config):
# validate install command
for x in range(0, 5):
with tempfile.TemporaryDirectory() as roles_path:
cfg = ansible_config('anonymous_user')
cfg = ansible_config(github_user)
install_pid = ansible_galaxy(
f"role install --force -p {roles_path} {github_user}.{role_name}",
ansible_config=cfg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_import_role_as_owner_no_tags(ansible_config):
assert '<h1>role1</h1>' in content['readme_html']

# validate cli search
cfg = ansible_config('anonymous_user')
cfg = ansible_config(github_user)
search_pid = ansible_galaxy(
f"role search --author={github_user} {role_name}",
ansible_config=cfg,
Expand Down
7 changes: 4 additions & 3 deletions galaxy_ng/tests/integration/community/test_v1_namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ def test_social_auth_creates_v3_namespace_as_v1_provider(ansible_config):


@pytest.mark.deployment_community
def test_v1_namespace_provider_filter(ansible_config):
def test_v1_namespace_provider_filter(ansible_config, galaxy_client):

admin_config = ansible_config('admin')
gc = galaxy_client('admin')
admin_client = get_client(config=admin_config, request_token=False, require_auth=True)

# 2 v1 namespaces
Expand All @@ -96,12 +97,12 @@ def test_v1_namespace_provider_filter(ansible_config):
v1_b_id = v1_b['id']

# make 1 v3 namespace
v3_a_name = generate_unused_namespace(admin_client)
v3_a_name = generate_unused_namespace(gc)
v3_a = admin_client(
'/api/v3/namespaces/', method='POST', args={'name': v3_a_name, 'groups': []}
)
v3_a_id = v3_a['id']
v3_b_name = generate_unused_namespace(admin_client)
v3_b_name = generate_unused_namespace(gc)
v3_b = admin_client(
'/api/v3/namespaces/', method='POST', args={'name': v3_b_name, 'groups': []}
)
Expand Down
5 changes: 2 additions & 3 deletions galaxy_ng/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def auto_approved_artifacts(ansible_config, artifact, galaxy_client):

# make sure the expected namespace exists ...
config = ansible_config("partner_engineer")
api_client = get_client(config)
gc = galaxy_client("partner_engineer")
create_namespace(gc, artifact.namespace, "")

Expand All @@ -220,7 +219,7 @@ def auto_approved_artifacts(ansible_config, artifact, galaxy_client):
f"v3/plugin/ansible/content/published/collections/index/"
f"{artifact.namespace}/{artifact.name}/versions/{artifact.version}/"
)
wait_for_url(api_client, dest_url)
wait_for_url(gc, dest_url)

# Increase collection version
new_version = increment_version(artifact.version)
Expand All @@ -241,7 +240,7 @@ def auto_approved_artifacts(ansible_config, artifact, galaxy_client):
f"v3/plugin/ansible/content/published/collections/index/"
f"{artifact2.namespace}/{artifact2.name}/versions/{artifact2.version}/"
)
wait_for_url(api_client, dest_url)
wait_for_url(gc, dest_url)
return artifact, artifact2


Expand Down

0 comments on commit f0a08fb

Please sign in to comment.