File size: 2,793 Bytes
845996e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- a/src/fastapi_cloud_cli/api/_models.py
+++ b/src/fastapi_cloud_cli/api/_models.py
@@ -107,6 +107,7 @@
     building_image = "building_image"
     building_image_failed = "building_image_failed"
     building_image_failed_timeout = "building_image_failed_timeout"
+    build_skipped = "build_skipped"
     deploying = "deploying"
     deploying_skipped = "deploying_skipped"
     deploying_failed = "deploying_failed"
@@ -133,6 +134,7 @@
             cls.building_image: "Building Image",
             cls.building_image_failed: "Build Failed",
             cls.building_image_failed_timeout: "Build Timed Out",
+            cls.build_skipped: "Build Skipped",
             cls.deploying: "Deploying Image",
             cls.deploying_skipped: "Deployment Skipped",
             cls.deploying_failed: "Deployment Failed",
@@ -145,7 +147,7 @@
             cls.degraded: "Degraded",
             cls.expired: "Expired",
             cls.failed: "Failed",
-        }[status]
+        }.get(status, "Unknown")
 
 
 class Deployment(BaseModel):
--- /dev/null
+++ b/tests/test_deployment_status.py
@@ -0,0 +1,40 @@
+from fastapi_cloud_cli.api._models import DeploymentStatus
+
+
+def test_build_skipped_status_exists():
+    # Fails today: DeploymentStatus has no build_skipped member (src/fastapi_cloud_cli/api/_models.py, class DeploymentStatus).
+    assert DeploymentStatus("build_skipped") is DeploymentStatus.build_skipped
+
+
+def test_build_skipped_human_readable():
+    # Fails today: no build_skipped member, so the lookup raises KeyError (src/fastapi_cloud_cli/api/_models.py, to_human_readable).
+    assert (
+        DeploymentStatus.to_human_readable(DeploymentStatus.build_skipped)
+        == "Build Skipped"
+    )
+
+
+def test_unknown_status_returns_unknown():
+    # Fails today: the dict lookup `}[status]` raises KeyError for a non-member (src/fastapi_cloud_cli/api/_models.py, to_human_readable).
+    assert DeploymentStatus.to_human_readable("some_new_status") == "Unknown"
+
+
+def test_existing_labels_unchanged():
+    # Fails today: "some_new_status" raises KeyError before the fix; guards the existing mapping.
+    assert DeploymentStatus.to_human_readable(DeploymentStatus.success) == "Ready"
+    assert (
+        DeploymentStatus.to_human_readable(DeploymentStatus.verifying_skipped)
+        == "Verification Skipped"
+    )
+    assert (
+        DeploymentStatus.to_human_readable(DeploymentStatus.deploying_skipped)
+        == "Deployment Skipped"
+    )
+
+
+def test_every_member_has_a_label():
+    # Fails today: build_skipped is missing, and any gap would surface as "Unknown".
+    for member in DeploymentStatus:
+        label = DeploymentStatus.to_human_readable(member)
+        assert isinstance(label, str)
+        assert label != "Unknown"