From 8cfdc43a331fef84da182ee8f4a2ac29a6f127f5 Mon Sep 17 00:00:00 2001 From: Jonas Maurus Date: Sat, 17 Aug 2024 13:56:49 +0200 Subject: [PATCH] More formatting alignment I understand that my formatting lacks rhyme or reason, but now this is consistent with the rest of the files. --- aptly_api/client.py | 5 +- aptly_api/tests/test_mirrors.py | 153 +++++++++++++++----------------- 2 files changed, 75 insertions(+), 83 deletions(-) diff --git a/aptly_api/client.py b/aptly_api/client.py index bfce19b..b9a9851 100644 --- a/aptly_api/client.py +++ b/aptly_api/client.py @@ -32,9 +32,8 @@ def __init__(self, aptly_server_url: str, ssl_verify: Union[str, bool, None] = N ssl_cert=ssl_cert, http_auth=http_auth, timeout=timeout) self.snapshots = SnapshotAPISection(base_url=self.__aptly_server_url, ssl_verify=ssl_verify, ssl_cert=ssl_cert, http_auth=http_auth, timeout=timeout) - self.mirrors = MirrorsAPISection( - base_url=self.__aptly_server_url, ssl_verify=ssl_verify, - ssl_cert=ssl_cert, http_auth=http_auth, timeout=timeout) + self.mirrors = MirrorsAPISection(base_url=self.__aptly_server_url, ssl_verify=ssl_verify, + ssl_cert=ssl_cert, http_auth=http_auth, timeout=timeout) @property def aptly_server_url(self) -> str: diff --git a/aptly_api/tests/test_mirrors.py b/aptly_api/tests/test_mirrors.py index 07c1103..4a84895 100644 --- a/aptly_api/tests/test_mirrors.py +++ b/aptly_api/tests/test_mirrors.py @@ -21,29 +21,30 @@ def __init__(self, *args: Any) -> None: def test_create(self, *, rmock: requests_mock.Mocker) -> None: rmock.post("http://test/api/mirrors", text="""{"UUID": "2cb5985a-a23f-4a1f-8eb6-d5409193b4eb", - "Name": "aptly-mirror", - "ArchiveRoot": "https://deb.nodesource.com/node_10.x/", - "Distribution": "bionic", "Components": ["main"], - "Architectures": ["amd64"], - "Meta": [{"Architectures": "i386 amd64 armhf arm64", - "Codename": "bionic", "Components": "main", - "Date": "Tue, 06 Apr 2021 21:05:41 UTC", - "Description": " Apt Repository for the Node.JS 10.x Branch", - "Label": "Node Source", "Origin": "Node Source"}], - "LastDownloadDate": "0001-01-01T00:00:00Z", - "Filter": "test", "Status": 0, "WorkerPID": 0, - "FilterWithDeps": true, "SkipComponentCheck": true, - "SkipArchitectureCheck": true, "DownloadSources": true, - "DownloadUdebs": true, "DownloadInstaller": true}""" - ) + "Name": "aptly-mirror", + "ArchiveRoot": "https://deb.nodesource.com/node_10.x/", + "Distribution": "bionic", "Components": ["main"], + "Architectures": ["amd64"], + "Meta": [{"Architectures": "i386 amd64 armhf arm64", + "Codename": "bionic", "Components": "main", + "Date": "Tue, 06 Apr 2021 21:05:41 UTC", + "Description": " Apt Repository for the Node.JS 10.x Branch", + "Label": "Node Source", "Origin": "Node Source"}], + "LastDownloadDate": "0001-01-01T00:00:00Z", + "Filter": "test", "Status": 0, "WorkerPID": 0, + "FilterWithDeps": true, "SkipComponentCheck": true, + "SkipArchitectureCheck": true, "DownloadSources": true, + "DownloadUdebs": true, "DownloadInstaller": true}""") self.assertSequenceEqual( - self.miapi.create(name="aptly-mirror", archiveurl='https://deb.nodesource.com/node_10.x/', - distribution='bionic', components=["main"], - architectures=["amd64"], - filter="test", download_udebs=True, - download_sources=True, download_installer=True, - skip_component_check=True, filter_with_deps=True, - keyrings=["/path/to/keyring"], ignore_signatures=True), + self.miapi.create( + name="aptly-mirror", archiveurl='https://deb.nodesource.com/node_10.x/', + distribution='bionic', components=["main"], + architectures=["amd64"], + filter="test", download_udebs=True, + download_sources=True, download_installer=True, + skip_component_check=True, filter_with_deps=True, + keyrings=["/path/to/keyring"], ignore_signatures=True + ), Mirror( uuid='2cb5985a-a23f-4a1f-8eb6-d5409193b4eb', name="aptly-mirror", @@ -67,28 +68,26 @@ def test_create(self, *, rmock: requests_mock.Mocker) -> None: download_sources=True, download_udebs=True, download_installer=True - ) ) def test_list(self, *, rmock: requests_mock.Mocker) -> None: rmock.get("http://test/api/mirrors", text="""[{"UUID": "2cb5985a-a23f-4a1f-8eb6-d5409193b4eb", - "Name": "aptly-mirror", - "ArchiveRoot": "https://deb.nodesource.com/node_10.x/", - "Distribution": "bionic", "Components": ["main"], - "Architectures": ["amd64"], - "Meta": [{"Architectures": "i386 amd64 armhf arm64", - "Codename": "bionic", "Components": "main", - "Date": "Tue, 06 Apr 2021 21:05:41 UTC", - "Description": " Apt Repository for the Node.JS 10.x Branch", - "Label": "Node Source", "Origin": "Node Source"}], - "LastDownloadDate": "0001-01-01T00:00:00Z", "Filter": "", - "Status": 0, "WorkerPID": 0, "FilterWithDeps": false, - "SkipComponentCheck": false, "SkipArchitectureCheck": false, - "DownloadSources": false, "DownloadUdebs": false, - "DownloadInstaller": false}]""" - ) + "Name": "aptly-mirror", + "ArchiveRoot": "https://deb.nodesource.com/node_10.x/", + "Distribution": "bionic", "Components": ["main"], + "Architectures": ["amd64"], + "Meta": [{"Architectures": "i386 amd64 armhf arm64", + "Codename": "bionic", "Components": "main", + "Date": "Tue, 06 Apr 2021 21:05:41 UTC", + "Description": " Apt Repository for the Node.JS 10.x Branch", + "Label": "Node Source", "Origin": "Node Source"}], + "LastDownloadDate": "0001-01-01T00:00:00Z", "Filter": "", + "Status": 0, "WorkerPID": 0, "FilterWithDeps": false, + "SkipComponentCheck": false, "SkipArchitectureCheck": false, + "DownloadSources": false, "DownloadUdebs": false, + "DownloadInstaller": false}]""") self.assertSequenceEqual( self.miapi.list(), [ @@ -123,21 +122,20 @@ def test_list(self, *, rmock: requests_mock.Mocker) -> None: def test_show(self, *, rmock: requests_mock.Mocker) -> None: rmock.get("http://test/api/mirrors/aptly-mirror", text="""{"UUID": "2cb5985a-a23f-4a1f-8eb6-d5409193b4eb", - "Name": "aptly-mirror", - "ArchiveRoot": "https://deb.nodesource.com/node_10.x/", - "Distribution": "bionic", "Components": ["main"], - "Architectures": ["amd64"], - "Meta": [{"Architectures": "i386 amd64 armhf arm64", - "Codename": "bionic", "Components": "main", - "Date": "Tue, 06 Apr 2021 21:05:41 UTC", - "Description": " Apt Repository for the Node.JS 10.x Branch", - "Label": "Node Source", "Origin": "Node Source"}], - "LastDownloadDate": "0001-01-01T00:00:00Z", "Filter": "", - "Status": 0, "WorkerPID": 0, "FilterWithDeps": false, - "SkipComponentCheck": false, "SkipArchitectureCheck": false, - "DownloadSources": false, "DownloadUdebs": false, - "DownloadInstaller": false}""" - ) + "Name": "aptly-mirror", + "ArchiveRoot": "https://deb.nodesource.com/node_10.x/", + "Distribution": "bionic", "Components": ["main"], + "Architectures": ["amd64"], + "Meta": [{"Architectures": "i386 amd64 armhf arm64", + "Codename": "bionic", "Components": "main", + "Date": "Tue, 06 Apr 2021 21:05:41 UTC", + "Description": " Apt Repository for the Node.JS 10.x Branch", + "Label": "Node Source", "Origin": "Node Source"}], + "LastDownloadDate": "0001-01-01T00:00:00Z", "Filter": "", + "Status": 0, "WorkerPID": 0, "FilterWithDeps": false, + "SkipComponentCheck": false, "SkipArchitectureCheck": false, + "DownloadSources": false, "DownloadUdebs": false, + "DownloadInstaller": false}""") self.assertSequenceEqual( self.miapi.show(name="aptly-mirror"), Mirror( @@ -186,33 +184,28 @@ def test_list_packages(self, *, rmock: requests_mock.Mocker) -> None: def test_list_packages_details(self, *, rmock: requests_mock.Mocker) -> None: rmock.get( "http://test/api/mirrors/aptly-mirror/packages?format=details", - text="""[{ - "Architecture":"amd64", - "Conflicts": "nodejs-dev, nodejs-legacy, npm", - "Depends":"1libc6 (>= 2.9), libgcc1 (>= 1:3.4),""" - """ libstdc++6 (>= 4.4.0), python-minimal, ca-certificates", - "Description":" Node.js event-based server-side javascript engine\\n", - "Filename":"nodejs_10.24.1-1nodesource1_amd64.deb", - "FilesHash":"1f74a6abf6acc572", - "Homepage":"https://nodejs.org", - "Installed-Size":"78630", - "Key":"Pamd64 nodejs 10.24.1-1nodesource1 1f74a6abf6acc572", - "License":"unknown", - "MD5sum":"6d9f0e30396cb6c20945ff6de2f9f322", - "Maintainer":"Ivan Iguaran ", - "Package":"nodejs", - "Priority":"optional", - "Provides":"nodejs-dev, nodejs-legacy, npm", - "SHA1":"a3bc5a29614eab366bb3644abb1e602b5c8953d5", - "SHA256":"4b374d16b536cf1a3963ddc4575ed2b68b28b0b5ea6eefe93c942dfc0ed35177", - "SHA512":"bf203bb319de0c5f7ed3b6ba69de39b1ea8b5086b872561379bd462dd93f0796""" - """9ca64fa01ade01ff08fa13a4e5e28625b59292ba44bc01ba876ec95875630460", - "Section":"web", - "ShortKey":"Pamd64 nodejs 10.24.1-1nodesource1", - "Size":"15949164", - "Version":"10.24.1-1nodesource1" - }]""" - ) + text='[{"Architecture":"amd64",' + '"Conflicts": "nodejs-dev, nodejs-legacy, npm",' + '"Depends":"1libc6 (>= 2.9), libgcc1 (>= 1:3.4),' + 'libstdc++6 (>= 4.4.0), python-minimal, ca-certificates",' + '"Description":" Node.js event-based server-side javascript engine\\n",' + '"Filename":"nodejs_10.24.1-1nodesource1_amd64.deb",' + '"FilesHash":"1f74a6abf6acc572",' + '"Homepage":"https://nodejs.org",' + '"Installed-Size":"78630", "Key":"Pamd64 nodejs 10.24.1-1nodesource11f74a6abf6acc572",' + '"License":"unknown",' + '"MD5sum":"6d9f0e30396cb6c20945ff6de2f9f322","Maintainer":"Ivan Iguaran ",' + '"Package":"nodejs",' + '"Priority":"optional",' + '"Provides":"nodejs-dev, nodejs-legacy, npm",' + '"SHA1":"a3bc5a29614eab366bb3644abb1e602b5c8953d5",' + '"SHA256":"4b374d16b536cf1a3963ddc4575ed2b68b28b0b5ea6eefe93c942dfc0ed35177",' + '"SHA512":"bf203bb319de0c5f7ed3b6ba69de39b1ea8b5086b872561379bd462dd93f0796' + '9ca64fa01ade01ff08fa13a4e5e28625b59292ba44bc01ba876ec95875630460",' + '"Section":"web",' + '"ShortKey":"Pamd64 nodejs 10.24.1-1nodesource1",' + '"Size":"15949164",' + 'Version":"10.24.1-1nodesource1"}]') self.assertSequenceEqual( self.miapi.list_packages( "aptly-mirror", detailed=True, with_deps=True, query="nodejs"),