diff -Nru software-properties-0.99.38/debian/changelog software-properties-0.99.39/debian/changelog --- software-properties-0.99.38/debian/changelog 2023-08-23 03:57:54.000000000 +0000 +++ software-properties-0.99.39/debian/changelog 2023-08-25 21:17:31.000000000 +0000 @@ -1,3 +1,11 @@ +software-properties (0.99.39) mantic; urgency=medium + + * Add cjwatson patch to use getArchiveSubscriptionURL() for private PPAs + * Fix getArchiveSubscriptionURL() API call and tests + * Resolve adding private PPAs, which do not yet have a token LP: #1991553 + + -- Dimitri John Ledkov Fri, 25 Aug 2023 22:17:31 +0100 + software-properties (0.99.38) mantic; urgency=medium * Stop using KUrl and KFileDialog (LP: #1795278). Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/dbus/__pycache__/__init__.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/dbus/__pycache__/__init__.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/dbus/__pycache__/SoftwarePropertiesDBus.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/dbus/__pycache__/SoftwarePropertiesDBus.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogAdd.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogAdd.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogAddSourcesList.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogAddSourcesList.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogCacheOutdated.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogCacheOutdated.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogEdit.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogEdit.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogEditDeb822.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogEditDeb822.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogMirror.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogMirror.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/dialogs.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/dialogs.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogUaAttach.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogUaAttach.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogUaDetach.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogUaDetach.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/DialogUaFipsEnable.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/DialogUaFipsEnable.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/__init__.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/__init__.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/SimpleGtkbuilderApp.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/SimpleGtkbuilderApp.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/UbuntuProPage.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/UbuntuProPage.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/gtk/__pycache__/utils.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/gtk/__pycache__/utils.cpython-311.pyc differ diff -Nru software-properties-0.99.38/softwareproperties/ppa.py software-properties-0.99.39/softwareproperties/ppa.py --- software-properties-0.99.38/softwareproperties/ppa.py 2023-08-23 03:57:28.000000000 +0000 +++ software-properties-0.99.39/softwareproperties/ppa.py 2023-08-25 15:38:07.000000000 +0000 @@ -237,13 +237,15 @@ if self._username and self._password: return - for url in self.lp.me.getArchiveSubscriptionURLs(): - parsed = urlparse(url) - if parsed.path.startswith(f'/{self.teamname}/{self.ppaname}/ubuntu'): - self._username = parsed.username - self._password = parsed.password - break - else: + try: + # Named ops work against actual person, not the me alias object + me = self.lp.people(self.lp.me.name) + url = me.getArchiveSubscriptionURL(archive=self.lpppa) + except Unauthorized: msg = (_("Could not find PPA subscription for ppa:%s/%s, you may need to request access") % (self.teamname, self.ppaname)) raise ShortcutException(msg) + else: + parsed = urlparse(url) + self._username = parsed.username + self._password = parsed.password Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/AptAuth.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/AptAuth.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/cloudarchive.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/cloudarchive.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/__init__.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/__init__.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/MirrorTest.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/MirrorTest.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/ppa.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/ppa.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/shortcuthandler.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/shortcuthandler.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/shortcuts.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/shortcuts.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/SoftwareProperties.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/SoftwareProperties.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/sourceslist.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/sourceslist.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/sourceutils.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/sourceutils.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/__pycache__/uri.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/__pycache__/uri.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/qt/__pycache__/CdromProgress.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/qt/__pycache__/CdromProgress.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/qt/__pycache__/DialogAdd.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/qt/__pycache__/DialogAdd.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/qt/__pycache__/DialogEdit.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/qt/__pycache__/DialogEdit.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/qt/__pycache__/DialogMirror.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/qt/__pycache__/DialogMirror.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/qt/__pycache__/I18nHelper.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/qt/__pycache__/I18nHelper.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/softwareproperties/qt/__pycache__/__init__.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/softwareproperties/qt/__pycache__/__init__.cpython-311.pyc differ diff -Nru software-properties-0.99.38/software_properties.egg-info/dependency_links.txt software-properties-0.99.39/software_properties.egg-info/dependency_links.txt --- software-properties-0.99.38/software_properties.egg-info/dependency_links.txt 1970-01-01 00:00:00.000000000 +0000 +++ software-properties-0.99.39/software_properties.egg-info/dependency_links.txt 2023-08-25 15:27:46.000000000 +0000 @@ -0,0 +1 @@ + diff -Nru software-properties-0.99.38/software_properties.egg-info/PKG-INFO software-properties-0.99.39/software_properties.egg-info/PKG-INFO --- software-properties-0.99.38/software_properties.egg-info/PKG-INFO 1970-01-01 00:00:00.000000000 +0000 +++ software-properties-0.99.39/software_properties.egg-info/PKG-INFO 2023-08-25 15:27:46.000000000 +0000 @@ -0,0 +1,21 @@ +Metadata-Version: 2.1 +Name: software-properties +Version: 0.96 +Requires: apt +Requires: apt_pkg +Requires: aptsources +Requires: dbus +Requires: distro_info +Requires: gi +Requires: gi.repository.GLib +Requires: gi.repository.GObject +Requires: gi.repository.Gdk +Requires: gi.repository.GdkPixbuf +Requires: gi.repository.Gio +Requires: gi.repository.Gtk +Requires: gi.repository.Handy +Requires: gi.repository.PackageKitGlib +Requires: launchpadlib.launchpad +Provides: softwareproperties +License-File: COPYING +License-File: AUTHORS diff -Nru software-properties-0.99.38/software_properties.egg-info/SOURCES.txt software-properties-0.99.39/software_properties.egg-info/SOURCES.txt --- software-properties-0.99.38/software_properties.egg-info/SOURCES.txt 1970-01-01 00:00:00.000000000 +0000 +++ software-properties-0.99.39/software_properties.egg-info/SOURCES.txt 2023-08-25 15:27:46.000000000 +0000 @@ -0,0 +1,81 @@ +AUTHORS +COPYING +README +add-apt-repository +setup.cfg +setup.py +software-properties-dbus +software-properties-gtk +software-properties-qt +data/com.ubuntu.SoftwareProperties.conf +data/com.ubuntu.SoftwareProperties.gschema.xml +data/com.ubuntu.SoftwareProperties.service +data/com.ubuntu.softwareproperties.policy.in +data/software-properties-gtk.appdata.xml.in +data/ubuntu-pro-logo-dark.svg +data/ubuntu-pro-logo.svg +data/designer/dialog_add.ui +data/designer/dialog_edit.ui +data/designer/dialog_mirror.ui +data/designer/main.ui +data/gtkbuilder/dialog-add-sources-list.ui +data/gtkbuilder/dialog-add.ui +data/gtkbuilder/dialog-cache-outofdate.ui +data/gtkbuilder/dialog-cdrom-progress.ui +data/gtkbuilder/dialog-edit-deb822-source.ui +data/gtkbuilder/dialog-edit-source.ui +data/gtkbuilder/dialog-mirror.ui +data/gtkbuilder/dialog-ua-attach.ui +data/gtkbuilder/dialog-ua-detach.ui +data/gtkbuilder/dialog-ua-fips-enable.ui +data/gtkbuilder/main.ui +data/mime/apt.xml.in +software_properties.egg-info/PKG-INFO +software_properties.egg-info/SOURCES.txt +software_properties.egg-info/dependency_links.txt +software_properties.egg-info/top_level.txt +softwareproperties/AptAuth.py +softwareproperties/CountryInformation.py +softwareproperties/MirrorTest.py +softwareproperties/SoftwareProperties.py +softwareproperties/__init__.py +softwareproperties/cloudarchive.py +softwareproperties/distro.py +softwareproperties/ppa.py +softwareproperties/shortcuthandler.py +softwareproperties/shortcuts.py +softwareproperties/sourceslist.py +softwareproperties/sourceutils.py +softwareproperties/uri.py +softwareproperties/dbus/SoftwarePropertiesDBus.py +softwareproperties/dbus/__init__.py +softwareproperties/gtk/CdromProgress.py +softwareproperties/gtk/DialogAdd.py +softwareproperties/gtk/DialogAddSourcesList.py +softwareproperties/gtk/DialogCacheOutdated.py +softwareproperties/gtk/DialogEdit.py +softwareproperties/gtk/DialogEditDeb822.py +softwareproperties/gtk/DialogMirror.py +softwareproperties/gtk/DialogUaAttach.py +softwareproperties/gtk/DialogUaDetach.py +softwareproperties/gtk/DialogUaFipsEnable.py +softwareproperties/gtk/SimpleGtkbuilderApp.py +softwareproperties/gtk/SoftwarePropertiesGtk.py +softwareproperties/gtk/UbuntuProPage.py +softwareproperties/gtk/__init__.py +softwareproperties/gtk/dialogs.py +softwareproperties/gtk/utils.py +softwareproperties/qt/CdromProgress.py +softwareproperties/qt/DialogAdd.py +softwareproperties/qt/DialogEdit.py +softwareproperties/qt/DialogMirror.py +softwareproperties/qt/I18nHelper.py +softwareproperties/qt/SoftwarePropertiesQt.py +softwareproperties/qt/__init__.py +tests/test_add_apt_repository.py +tests/test_aptauth.py +tests/test_aptsources.py +tests/test_dbus.py +tests/test_pyflakes.py +tests/test_shortcuts.py +tests/test_sp.py \ No newline at end of file diff -Nru software-properties-0.99.38/software_properties.egg-info/top_level.txt software-properties-0.99.39/software_properties.egg-info/top_level.txt --- software-properties-0.99.38/software_properties.egg-info/top_level.txt 1970-01-01 00:00:00.000000000 +0000 +++ software-properties-0.99.39/software_properties.egg-info/top_level.txt 2023-08-25 15:27:46.000000000 +0000 @@ -0,0 +1 @@ +softwareproperties diff -Nru software-properties-0.99.38/tests/aptroot/etc/apt/apt.conf.d/10periodic software-properties-0.99.39/tests/aptroot/etc/apt/apt.conf.d/10periodic --- software-properties-0.99.38/tests/aptroot/etc/apt/apt.conf.d/10periodic 1970-01-01 00:00:00.000000000 +0000 +++ software-properties-0.99.39/tests/aptroot/etc/apt/apt.conf.d/10periodic 2023-08-25 15:27:49.000000000 +0000 @@ -0,0 +1,3 @@ +APT::Periodic::Unattended-Upgrade "0"; +APT::Periodic::Download-Upgradeable-Packages "0"; +APT::Periodic::Update-Package-Lists "0"; diff -Nru software-properties-0.99.38/tests/aptroot/etc/apt/sources.list software-properties-0.99.39/tests/aptroot/etc/apt/sources.list --- software-properties-0.99.38/tests/aptroot/etc/apt/sources.list 1970-01-01 00:00:00.000000000 +0000 +++ software-properties-0.99.39/tests/aptroot/etc/apt/sources.list 2023-08-25 15:27:49.000000000 +0000 @@ -0,0 +1 @@ +deb http://archive.ubuntu.com/ubuntu bionic main restricted # comment with unicode äöü diff -Nru software-properties-0.99.38/tests/aptroot/etc/apt/sources.list.save software-properties-0.99.39/tests/aptroot/etc/apt/sources.list.save --- software-properties-0.99.38/tests/aptroot/etc/apt/sources.list.save 1970-01-01 00:00:00.000000000 +0000 +++ software-properties-0.99.39/tests/aptroot/etc/apt/sources.list.save 2023-08-25 15:27:49.000000000 +0000 @@ -0,0 +1 @@ +# deb http://archive.ubuntu.com/ubuntu bionic main restricted # comment with unicode äöü Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/aptroot/etc/apt/trusted.gpg and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/aptroot/etc/apt/trusted.gpg differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/__init__.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/__init__.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/test_add_apt_repository.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/test_add_apt_repository.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/test_aptauth.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/test_aptauth.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/test_aptsources.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/test_aptsources.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/test_dbus.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/test_dbus.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/test_pyflakes.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/test_pyflakes.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/test_shortcuts.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/test_shortcuts.cpython-311.pyc differ Binary files /tmp/tmp63y1czx7/AQtLmHi4Lr/software-properties-0.99.38/tests/__pycache__/test_sp.cpython-311.pyc and /tmp/tmp63y1czx7/TtjHa9AtFK/software-properties-0.99.39/tests/__pycache__/test_sp.cpython-311.pyc differ diff -Nru software-properties-0.99.38/tests/test_shortcuts.py software-properties-0.99.39/tests/test_shortcuts.py --- software-properties-0.99.38/tests/test_shortcuts.py 2023-08-23 03:57:28.000000000 +0000 +++ software-properties-0.99.39/tests/test_shortcuts.py 2023-08-25 15:38:07.000000000 +0000 @@ -2,6 +2,7 @@ import apt +from functools import partial import unittest import sys import os @@ -11,6 +12,7 @@ from contextlib import contextmanager from http.client import HTTPException from launchpadlib.launchpad import Launchpad +from lazr.restfulclient.errors import Unauthorized from urllib.request import urlopen from urllib.error import URLError from unittest.mock import (patch, Mock) @@ -21,7 +23,7 @@ from softwareproperties.uri import URIShortcutHandler from softwareproperties.cloudarchive import CloudArchiveShortcutHandler from softwareproperties.ppa import PPAShortcutHandler -from softwareproperties.shortcuthandler import InvalidShortcutException +from softwareproperties.shortcuthandler import InvalidShortcutException, ShortcutException from softwareproperties.shortcuts import shortcut_handler @@ -45,7 +47,7 @@ Components: main """ PRIVATE_PPA_NETRCCONTENT = f"machine private-ppa.launchpadcontent.net/ddstreet/ppa/ubuntu/ login ddstreet password {PRIVATE_PPA_PASSWORD}" -PRIVATE_PPA_SUBSCRIPTION_URLS = [f"https://ddstreet:{PRIVATE_PPA_PASSWORD}@private-ppa.launchpadcontent.net/ddstreet/ppa/ubuntu/"] +PRIVATE_PPA_SUBSCRIPTION_URL = f"https://ddstreet:{PRIVATE_PPA_PASSWORD}@private-ppa.launchpadcontent.net/ddstreet/ppa/ubuntu/" # These must match the uca used in VALID_UCAS UCA_CANAME = "train" @@ -81,12 +83,13 @@ return True def mock_login_with(*args, **kwargs): + has_subscription = kwargs.pop("has_subscription", True) + _lp = Launchpad.login_anonymously(*args, **kwargs) lp = Mock(wraps=_lp) lp.me = Mock() lp.me.name = 'ddstreet' - lp.me.getArchiveSubscriptionURLs = lambda: PRIVATE_PPA_SUBSCRIPTION_URLS def mock_getPPAByName(_team, name): _ppa = _team.getPPAByName(name=name) @@ -99,6 +102,15 @@ _team = _lp.people(teamname) team = Mock(wraps=_team) team.getPPAByName = lambda name: mock_getPPAByName(_team, name) + team.getArchiveSubscriptionURL = lambda archive: PRIVATE_PPA_SUBSCRIPTION_URL + if has_subscription: + team.getArchiveSubscriptionURL = lambda archive: PRIVATE_PPA_SUBSCRIPTION_URL + else: + def raise_unauthorized(archive): + raise Unauthorized(Mock(), Mock()) + + team.getArchiveSubscriptionURL = raise_unauthorized + return team lp.people = mock_people @@ -215,6 +227,15 @@ trustedcontent=True, netrccontent=PRIVATE_PPA_NETRCCONTENT) + @unittest.skipUnless(has_network(), "requires network") + def test_shortcut_private_ppa_no_subscription(self): + # this is the same tests as the public ppa, but login=True will use the mocked lp instance + # this *does not* actually test/verify this works with a real private ppa; that must be done manually + with patch('launchpadlib.launchpad.Launchpad.login_with', new=partial(mock_login_with, has_subscription=False)): + for ppa in VALID_PPAS: + with self.assertRaises(ShortcutException): + self.create_handler(ppa, PPAShortcutHandler, login=True) + @contextmanager def ca_allow_codename(self, codename): key = "CA_ALLOW_CODENAME"