This commit is contained in:
+3
-1
@@ -77,7 +77,9 @@ class AutoDLClient:
|
||||
"/api/v1/dev/instance/pro/image/private/list",
|
||||
{"page_index": 1, "page_size": 100},
|
||||
)
|
||||
return list(data.get("list", []))
|
||||
# AutoDL returns JSON null instead of [] when the account has no
|
||||
# private images. Treat both representations as an empty result.
|
||||
return list(data.get("list") or [])
|
||||
|
||||
def create(self, spec: dict[str, Any]) -> str:
|
||||
return str(self.request("POST", "/api/v1/dev/instance/pro/create", spec))
|
||||
|
||||
@@ -8,6 +8,12 @@ import controller
|
||||
|
||||
|
||||
class ControllerTests(unittest.TestCase):
|
||||
def test_list_images_accepts_null_for_an_empty_account(self):
|
||||
client = controller.AutoDLClient("test-token")
|
||||
client.request = lambda method, path, body: {"list": None}
|
||||
|
||||
self.assertEqual(client.list_images(), [])
|
||||
|
||||
def test_runner_release_is_pinned(self):
|
||||
self.assertEqual(controller.RUNNER_VERSION, "3.5.0")
|
||||
self.assertEqual(len(controller.RUNNER_SHA256), 64)
|
||||
|
||||
Reference in New Issue
Block a user