Skip to content

Commit

Permalink
increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Oct 1, 2024
1 parent cbaa491 commit a324b62
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion system/t12_api/gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def check(self):
with tempfile.NamedTemporaryFile(suffix=".pub") as keyring:
gpgkeyid = "9E3E53F19C7DE460"
resp = self.post("/api/gpg/key", json={
"Keyserver": "keyserver.ubuntu.com",
"Keyserver": "hkp://keyserver.ubuntu.com:80",
"Keyring": keyring.name,
"GpgKeyID": gpgkeyid
})
Expand Down
57 changes: 57 additions & 0 deletions system/t12_api/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,63 @@ def check(self):
})
self.check_equal(resp.status_code, 200)

# dry run, all-matches
resp = self.post("/api/snapshots/pull?dry-run=1&all-matches=1", json={
'Source': snapshot_repo_with_libboost,
'To': snapshot_empty_repo,
'Destination': snapshot_pull_libboost,
'Queries': [
'libboost-program-options-dev'
],
'Architectures': [
'amd64'
'i386'
]
})
self.check_equal(resp.status_code, 200)

# missing argument
resp = self.post("/api/snapshots/pull", json={
'Source': snapshot_repo_with_libboost,
'To': snapshot_empty_repo,
'Destination': snapshot_pull_libboost,
})
self.check_equal(resp.status_code, 400)

# dry run, emtpy architectures
resp = self.post("/api/snapshots/pull?dry-run=1", json={
'Source': snapshot_repo_with_libboost,
'To': snapshot_empty_repo,
'Destination': snapshot_pull_libboost,
'Queries': [
'libboost-program-options-dev'
],
'Architectures': []
})
self.check_equal(resp.status_code, 500)

# dry run, non-existing To
resp = self.post("/api/snapshots/pull", json={
'Source': snapshot_repo_with_libboost,
'To': "asd123",
'Destination': snapshot_pull_libboost,
'Queries': [
'libboost-program-options-dev'
]
})
self.check_equal(resp.status_code, 404)

# dry run, non-existing source
resp = self.post("/api/snapshots/pull?dry-run=1", json={
'Source': "asd123",
'To': snapshot_empty_repo,
'Destination': snapshot_pull_libboost,
'Queries': [
'libboost-program-options-dev'
]
})
self.check_equal(resp.status_code, 404)

# snapshot pull
resp = self.post("/api/snapshots/pull", json={
'Source': snapshot_repo_with_libboost,
Expand Down

0 comments on commit a324b62

Please sign in to comment.