Skip to content

Commit

Permalink
Improve FlatpakManager testing
Browse files Browse the repository at this point in the history
Make some parts public and improve the defaults.

Resolves: RHEL-75804
  • Loading branch information
jkonecny12 committed Mar 5, 2025
1 parent 307054c commit c40a9c7
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions pyanaconda/modules/payloads/payload/flatpak/flatpak_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,36 @@ def __init__(self):
:param function callback: a progress reporting callback
"""
self._flatpak_refs = []
# FIXME: Not set by anything right now
self._source_repository = None

self._source = None
self._skip_installation = False
self._skip_installation = True
self._collection_location = None
self._progress: Optional[ProgressReporter] = None
self._transaction = None
self._download_location = None
self._download_size = 0
self._install_size = 0

@property
def flatpak_refs(self):
"""Get required flatpak refs for installation.
:returns: list of refs
:rtype: list
"""
return self._flatpak_refs

@property
def skip_installation(self):
"""Report if the installation of Flatpaks will be skipped.
:returns: True if the installation should be skipped
:rtype: bool
"""
return self._skip_installation

def set_sources(self, sources: List[PayloadSourceBase]):
"""Set the source object we use to download Flatpak content.
Expand Down Expand Up @@ -117,7 +137,8 @@ def download_location(self) -> str:
"""Get the download location."""
return self._download_location

def _get_source(self):
def get_source(self):
"""Retrieve flatpak source."""
if self._source is None:
if self._source_repository:
log.debug("Using Flatpak source repository at: %s/Flatpaks",
Expand Down Expand Up @@ -148,7 +169,7 @@ def calculate_size(self):

try:
self._download_size, self._install_size = \
self._get_source().calculate_size(self._flatpak_refs)
self.get_source().calculate_size(self._flatpak_refs)
except NoSourceError as e:
log.error("Flatpak source not available, skipping installing %s: %s",
", ".join(self._flatpak_refs), e)
Expand All @@ -175,7 +196,7 @@ def download(self, progress: ProgressReporter):
return

try:
self._collection_location = self._get_source().download(self._flatpak_refs,
self._collection_location = self.get_source().download(self._flatpak_refs,
self._download_location,
progress)
except NoSourceError as e:
Expand Down

0 comments on commit c40a9c7

Please sign in to comment.