mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-10-15 10:07:24 +00:00
improve api tests and error output
show only relevant aptly logs if a test fails. for async tasks, show task output, as it contains the error message.
This commit is contained in:
1 parent
8029305d32
commit
440c3debdc
11 files changed
+278
-175
No files matched your search
@@ -1,4 +1,4 @@
|
||||
from api_lib import TASK_SUCCEEDED, APITest
|
||||
from api_lib import APITest
|
||||
|
||||
|
||||
class MirrorsAPITestCreateShow(APITest):
|
||||
@@ -58,11 +58,8 @@ class MirrorsAPITestCreateUpdate(APITest):
|
||||
|
||||
mirror_desc["Name"] = self.random_name()
|
||||
resp = self.put_task("/api/mirrors/" + mirror_name, json=mirror_desc)
|
||||
self.check_equal(resp.status_code, 200)
|
||||
self.check_task(resp)
|
||||
_id = resp.json()['ID']
|
||||
if resp.json()["State"] != TASK_SUCCEEDED:
|
||||
resp = self.get("/api/tasks/" + str(_id) + "/output")
|
||||
raise Exception("task failed: " + str(resp.json()))
|
||||
|
||||
resp = self.get("/api/tasks/" + str(_id) + "/detail")
|
||||
self.check_equal(resp.status_code, 200)
|
||||
@@ -95,7 +92,7 @@ class MirrorsAPITestCreateDelete(APITest):
|
||||
self.check_equal(resp.status_code, 201)
|
||||
|
||||
resp = self.delete_task("/api/mirrors/" + mirror_name)
|
||||
self.check_equal(resp.json()['State'], TASK_SUCCEEDED)
|
||||
self.check_task(resp)
|
||||
|
||||
|
||||
class MirrorsAPITestCreateList(APITest):
|
||||
@@ -154,8 +151,4 @@ class MirrorsAPITestSkipArchitectureCheck(APITest):
|
||||
mirror_desc = {'Name': mirror_name,
|
||||
'IgnoreSignatures': True}
|
||||
resp = self.put_task("/api/mirrors/" + mirror_name, json=mirror_desc)
|
||||
self.check_equal(resp.status_code, 200)
|
||||
_id = resp.json()['ID']
|
||||
if resp.json()["State"] != TASK_SUCCEEDED:
|
||||
resp = self.get("/api/tasks/" + str(_id) + "/output")
|
||||
raise Exception("task failed: " + str(resp.json()))
|
||||
self.check_task(resp)
|
||||
Reference in new issue
Block a user