MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestStorageListJSONShape

Function TestStorageListJSONShape

internal/cli/cli_integration_test.go:89–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestStorageListJSONShape(t *testing.T) {
90 server := newStorageTestServer(t)
91 defer server.Close()
92
93 client := newTestClient(t, server.URL)
94
95 rows, err := fetchStorageRows(client, "pve01")
96 if err != nil {
97 t.Fatalf("fetchStorageRows returned error: %v", err)
98 }
99
100 // Round-trip through JSON to verify the output shape matches the spec.
101 data, err := json.Marshal(rows)
102 if err != nil {
103 t.Fatalf("json.Marshal: %v", err)
104 }
105
106 var decoded []storageListRow
107 if err := json.Unmarshal(data, &decoded); err != nil {
108 t.Fatalf("output is not valid JSON array of storage rows: %v", err)
109 }
110
111 if len(decoded) != len(rows) {
112 t.Errorf("decoded %d rows, want %d", len(decoded), len(rows))
113 }
114}
115
116func TestStorageContentListReturnsItems(t *testing.T) {
117 server := newStorageTestServer(t)

Callers

nothing calls this directly

Calls 4

newStorageTestServerFunction · 0.85
fetchStorageRowsFunction · 0.85
newTestClientFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected