Skip to content

Commit

Permalink
More formatting alignment
Browse files Browse the repository at this point in the history
I understand that my formatting lacks rhyme or reason, but now this
is consistent with the rest of the files.
  • Loading branch information
jdelic committed Aug 17, 2024
1 parent 31b2d94 commit 8cfdc43
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 83 deletions.
5 changes: 2 additions & 3 deletions aptly_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
153 changes: 73 additions & 80 deletions aptly_api/tests/test_mirrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(),
[
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 <[email protected]>",
"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 <[email protected]>",'
'"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"),
Expand Down

0 comments on commit 8cfdc43

Please sign in to comment.