def test_get_empty_refs_required_space(self, remote_cls, installation_cls, transaction_cls): """Test flatpak required space method with no refs.""" flatpak = FlatpakManager("any path") self._setup_flatpak_objects(remote_cls, installation_cls, transaction_cls) flatpak.initialize_with_system_path() self._installation.list_remote_refs_sync.return_value = [] assert flatpak.get_required_size() == 0
def test_get_required_space(self, remote_cls, installation_cls, transaction_cls): """Test flatpak required space method.""" flatpak = FlatpakManager("any path") self._setup_flatpak_objects(remote_cls, installation_cls, transaction_cls) flatpak.initialize_with_system_path() self._installation.list_remote_refs_sync.return_value = [ RefMock(installed_size=2000), RefMock(installed_size=3000), RefMock(installed_size=100) ] assert flatpak.get_required_size() == 5100
def run(self): """Find the size of flatpaks to install. :return: the required size :rtype: Size """ flatpak_payload = FlatpakManager(self._sysroot) # Initialize temporal repo to enable reading of the remote flatpak_payload.initialize_with_path("/var/tmp/anaconda-flatpak-temp") required_size = Size(flatpak_payload.get_required_size()) # Clean up temporal repo again flatpak_payload.cleanup() return required_size