mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-19 19:28:22 +00:00
Additional tests for aptly repo include. #71
This commit is contained in:
7
system/changes/uploaders1.json
Normal file
7
system/changes/uploaders1.json
Normal file
@@ -0,0 +1,7 @@
|
||||
// no groups, no rules => deny all
|
||||
{
|
||||
"groups": {
|
||||
},
|
||||
"rules": [
|
||||
]
|
||||
}
|
||||
14
system/changes/uploaders2.json
Normal file
14
system/changes/uploaders2.json
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
{
|
||||
"groups": {
|
||||
"developers": ["21DBB89C16DB3E6D", "37E1C17570096AD1"],
|
||||
},
|
||||
"rules": [
|
||||
{ "condition": "Source (dangerous) | Source (kernel)",
|
||||
"deny": ["*"],
|
||||
},
|
||||
{ "condition": "Source (hardlink)",
|
||||
"allow": ["developers", "admins"],
|
||||
}
|
||||
]
|
||||
}
|
||||
1
system/changes/uploaders3.json
Normal file
1
system/changes/uploaders3.json
Normal file
@@ -0,0 +1 @@
|
||||
{
|
||||
14
system/changes/uploaders4.json
Normal file
14
system/changes/uploaders4.json
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
{
|
||||
"groups": {
|
||||
"developers": ["21DBB89C16DB3E6D", "37E1C17570096AD1"],
|
||||
},
|
||||
"rules": [
|
||||
{ "condition": "Source (dangerous) | Source (kernel)",
|
||||
"deny": ["*"],
|
||||
},
|
||||
{ "condition": "Source (hardlink",
|
||||
"allow": ["developers", "admins"],
|
||||
}
|
||||
]
|
||||
}
|
||||
6
system/t09_repo/IncludeRepo13Test_gold
Normal file
6
system/t09_repo/IncludeRepo13Test_gold
Normal file
@@ -0,0 +1,6 @@
|
||||
gpgv: DSA key ID 16DB3E6D
|
||||
gpgv: Good signature from "Aptly Tester (don't use it) <test@aptly.info>"
|
||||
[!] changes file skipped due to uploaders config: hardlink_0.2.1_amd64.changes, keys []utils.GpgKey{"21DBB89C16DB3E6D"}: denied as no rule matches
|
||||
[!] Some files were skipped due to errors:
|
||||
/hardlink_0.2.1_amd64.changes
|
||||
ERROR: some files failed to be added
|
||||
5
system/t09_repo/IncludeRepo14Test_gold
Normal file
5
system/t09_repo/IncludeRepo14Test_gold
Normal file
@@ -0,0 +1,5 @@
|
||||
gpgv: DSA key ID 16DB3E6D
|
||||
gpgv: Good signature from "Aptly Tester (don't use it) <test@aptly.info>"
|
||||
Loading repository unstable for changes file hardlink_0.2.1_amd64.changes...
|
||||
[+] hardlink_0.2.1_source added
|
||||
[+] hardlink_0.2.1_amd64 added
|
||||
1
system/t09_repo/IncludeRepo15Test_gold
Normal file
1
system/t09_repo/IncludeRepo15Test_gold
Normal file
@@ -0,0 +1 @@
|
||||
ERROR: error loading uploaders file: open /uploaders-404.json: no such file or directory
|
||||
1
system/t09_repo/IncludeRepo16Test_gold
Normal file
1
system/t09_repo/IncludeRepo16Test_gold
Normal file
@@ -0,0 +1 @@
|
||||
ERROR: error loading uploaders file: unexpected EOF
|
||||
1
system/t09_repo/IncludeRepo17Test_gold
Normal file
1
system/t09_repo/IncludeRepo17Test_gold
Normal file
@@ -0,0 +1 @@
|
||||
ERROR: error parsing query Source (hardlink: parsing failed: unexpected token <EOL>: expecting ')'
|
||||
@@ -347,3 +347,62 @@ class IncludeRepo12Test(BaseTest):
|
||||
super(IncludeRepo12Test, self).check()
|
||||
finally:
|
||||
shutil.rmtree(self.tempSrcDir)
|
||||
|
||||
|
||||
class IncludeRepo13Test(BaseTest):
|
||||
"""
|
||||
include packages to local repo: with denying uploaders.json
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create unstable",
|
||||
]
|
||||
runCmd = "aptly repo include -uploaders-file=${changes}/uploaders1.json -no-remove-files -keyring=${files}/aptly.pub ${changes}"
|
||||
outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s))
|
||||
expectedCode = 1
|
||||
|
||||
|
||||
class IncludeRepo14Test(BaseTest):
|
||||
"""
|
||||
include packages to local repo: allow with uploaders.json
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create unstable",
|
||||
]
|
||||
runCmd = "aptly repo include -uploaders-file=${changes}/uploaders2.json -no-remove-files -keyring=${files}/aptly.pub ${changes}"
|
||||
outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s))
|
||||
|
||||
|
||||
class IncludeRepo15Test(BaseTest):
|
||||
"""
|
||||
include packages to local repo: no uploaders.json
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create unstable",
|
||||
]
|
||||
runCmd = "aptly repo include -uploaders-file=${changes}/uploaders-404.json -no-remove-files -keyring=${files}/aptly.pub ${changes}"
|
||||
outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s))
|
||||
expectedCode = 1
|
||||
|
||||
|
||||
class IncludeRepo16Test(BaseTest):
|
||||
"""
|
||||
include packages to local repo: malformed JSON
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create unstable",
|
||||
]
|
||||
runCmd = "aptly repo include -uploaders-file=${changes}/uploaders3.json -no-remove-files -keyring=${files}/aptly.pub ${changes}"
|
||||
outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s))
|
||||
expectedCode = 1
|
||||
|
||||
|
||||
class IncludeRepo17Test(BaseTest):
|
||||
"""
|
||||
include packages to local repo: malformed rule
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create unstable",
|
||||
]
|
||||
runCmd = "aptly repo include -uploaders-file=${changes}/uploaders4.json -no-remove-files -keyring=${files}/aptly.pub ${changes}"
|
||||
outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s))
|
||||
expectedCode = 1
|
||||
|
||||
Reference in New Issue
Block a user