Skip to content

Commit

Permalink
Extend the scan case with authenticated remote
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed Dec 5, 2024
1 parent 9326b19 commit 411d124
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
4 changes: 3 additions & 1 deletion robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,12 @@
'Fedora': {
'url': 'https://registry.fedoraproject.org',
'index_url': 'https://registry.fedoraproject.org/index/static?label:org.flatpak.ref:exists=1&tag=latest',
'authenticated': False,
},
'RedHat': {
'url': 'https://flatpaks.redhat.io',
'url': 'https://flatpaks.redhat.io/rhel/index/static?label:org.flatpak.ref:exists=1',
'index_url': 'https://flatpaks.redhat.io/rhel/index/static?label:org.flatpak.ref:exists=1&tag=latest',
'authenticated': True,
},
}

Expand Down
25 changes: 15 additions & 10 deletions tests/foreman/cli/test_flatpak.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import pytest
import requests

from robottelo.config import settings
from robottelo.constants import FLATPAK_REMOTES
from robottelo.exceptions import CLIReturnCodeError
from robottelo.utils.datafactory import gen_string
Expand Down Expand Up @@ -145,11 +146,14 @@ def test_CRUD_and_sync_flatpak_remote_with_permissions(
assert 'Error: flatpak_remote not found' in str(e)


def test_scan_flatpak_remote(target_sat, function_org, function_product):
@pytest.mark.parametrize('remote', FLATPAK_REMOTES.values(), ids=FLATPAK_REMOTES)
def test_scan_flatpak_remote(target_sat, function_org, function_product, remote):
"""Verify flatpak remote scan detects all repos available in the remote index.
:id: 3dff23f3-f415-4fb2-a41c-7cdcae617bb0
:parametrized: yes
:steps:
1. Create a flatpak remote and scan it.
2. Read the remote index via its API.
Expand All @@ -159,16 +163,17 @@ def test_scan_flatpak_remote(target_sat, function_org, function_product):
1. Repos scanned by flatpak remote match the repos available in the remote index.
"""
remote = FLATPAK_REMOTES['Fedora']

# 1. Create a flatpak remote and scan it.
fr = target_sat.cli.FlatpakRemote().create(
{
'organization-id': function_org.id,
'url': remote['url'],
'name': gen_string('alpha'),
}
)
create_opts = {
'organization-id': function_org.id,
'url': remote['url'],
'name': gen_string('alpha'),
}
if remote['authenticated']:
create_opts['username'] = settings.container_repo.registries.redhat.username
create_opts['token'] = settings.container_repo.registries.redhat.password

fr = target_sat.cli.FlatpakRemote().create(create_opts)
target_sat.cli.FlatpakRemote().scan({'id': fr['id']})

scanned_repos = target_sat.cli.FlatpakRemote().repository_list({'flatpak-remote-id': fr['id']})
Expand Down

0 comments on commit 411d124

Please sign in to comment.