Additional tests for aptly repo include. #71

This commit is contained in:
Andrey Smirnov
2015-03-20 00:18:32 +03:00
parent 54e21afee7
commit 962c4a842d
10 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
// no groups, no rules => deny all
{
"groups": {
},
"rules": [
]
}

View File

@@ -0,0 +1,14 @@
{
"groups": {
"developers": ["21DBB89C16DB3E6D", "37E1C17570096AD1"],
},
"rules": [
{ "condition": "Source (dangerous) | Source (kernel)",
"deny": ["*"],
},
{ "condition": "Source (hardlink)",
"allow": ["developers", "admins"],
}
]
}

View File

@@ -0,0 +1 @@
{

View File

@@ -0,0 +1,14 @@
{
"groups": {
"developers": ["21DBB89C16DB3E6D", "37E1C17570096AD1"],
},
"rules": [
{ "condition": "Source (dangerous) | Source (kernel)",
"deny": ["*"],
},
{ "condition": "Source (hardlink",
"allow": ["developers", "admins"],
}
]
}

View 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

View 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

View File

@@ -0,0 +1 @@
ERROR: error loading uploaders file: open /uploaders-404.json: no such file or directory

View File

@@ -0,0 +1 @@
ERROR: error loading uploaders file: unexpected EOF

View File

@@ -0,0 +1 @@
ERROR: error parsing query Source (hardlink: parsing failed: unexpected token <EOL>: expecting ')'

View File

@@ -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