Add -json output flag to repo list|show

Signed-off-by: Joshua Colson <joshua.colson@gmail.com>
This commit is contained in:
Joshua Colson
2021-09-16 09:23:35 -07:00
committed by Lorenzo Bolla
parent f9d08e1377
commit 1f56fb86e3
12 changed files with 150 additions and 19 deletions

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,20 @@
[
{
"Name": "repo1",
"Comment": "",
"DefaultDistribution": "",
"DefaultComponent": "main"
},
{
"Name": "repo2",
"Comment": "Cool2",
"DefaultDistribution": "",
"DefaultComponent": "main"
},
{
"Name": "repo3",
"Comment": "Cool3",
"DefaultDistribution": "",
"DefaultComponent": "main"
}
]

View File

@@ -0,0 +1,7 @@
{
"Name": "repo1",
"Comment": "Cool",
"DefaultDistribution": "squeeze",
"DefaultComponent": "main",
"Packages": []
}

View File

@@ -0,0 +1,12 @@
{
"Name": "repo2",
"Comment": "Cool",
"DefaultDistribution": "wheezy",
"DefaultComponent": "contrib",
"Packages": [
"Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378",
"Pi386 libboost-program-options-dev 1.62.0.1 7760e62f99c551cb",
"Psource pyspi 0.6.1-1.3 3a8b37cbd9a3559e",
"Psource pyspi 0.6.1-1.4 f8f1daa806004e89"
]
}

View File

@@ -37,3 +37,20 @@ class ListRepo4Test(BaseTest):
"aptly repo create repo1",
]
runCmd = "aptly repo list -raw"
class ListRepo5Test(BaseTest):
"""
list local repo: json no repos
"""
runCmd = "aptly repo list -json"
class ListRepo6Test(BaseTest):
"""
list local repo: json normal
"""
fixtureCmds = [
"aptly repo create -comment=Cool3 repo3",
"aptly repo create -comment=Cool2 repo2",
"aptly repo create repo1",
]
runCmd = "aptly repo list -json"

View File

@@ -26,3 +26,22 @@ class ShowRepo3Test(BaseTest):
"""
expectedCode = 1
runCmd = "aptly repo show repo3"
class ShowRepo4Test(BaseTest):
"""
show local repo: json regular
"""
fixtureCmds = ["aptly repo create -comment=Cool -distribution=squeeze repo1"]
runCmd = "aptly repo show -json repo1"
class ShowRepo5Test(BaseTest):
"""
show local repo: json -with-packages
"""
fixtureCmds = [
"aptly repo create -comment=Cool -distribution=wheezy -component=contrib repo2",
"aptly repo add repo2 ${files}"
]
runCmd = "aptly repo show -json -with-packages repo2"