MCPcopy Create free account
hub / github.com/conforma/cli / TestNewValidateVSACmd_Comprehensive

Function TestNewValidateVSACmd_Comprehensive

cmd/validate/vsa_test.go:70–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestNewValidateVSACmd_Comprehensive(t *testing.T) {
71 cmd := NewValidateVSACmd()
72
73 // Test command structure
74 assert.Equal(t, "vsa <vsa-identifier>", cmd.Use)
75 assert.NotEmpty(t, cmd.Short)
76 assert.NotEmpty(t, cmd.Long)
77
78 // Test all expected flags exist
79 flags := cmd.Flags()
80 expectedFlags := []string{
81 "vsa", "images", "policy",
82 "vsa-retrieval", "effective-time",
83 "vsa-expiration", "ignore-signature-verification",
84 "vsa-public-key", "no-fallback", "fallback-public-key",
85 "output", "strict", "workers", "no-color", "color",
86 }
87
88 for _, flagName := range expectedFlags {
89 assert.NotNil(t, flags.Lookup(flagName), "Expected flag %s to be present", flagName)
90 }
91
92 // Test flag properties
93 vsaFlag := flags.Lookup("vsa")
94 assert.Equal(t, "v", vsaFlag.Shorthand)
95 assert.Equal(t, "VSA identifier (image digest, file path)", vsaFlag.Usage)
96
97 policyFlag := flags.Lookup("policy")
98 assert.Equal(t, "p", policyFlag.Shorthand)
99 assert.Equal(t, "Policy configuration", policyFlag.Usage)
100
101 // Test flag properties
102 assert.NotNil(t, policyFlag, "Policy flag should be present")
103
104 // Test default values
105 assert.Equal(t, "now", flags.Lookup("effective-time").DefValue)
106 assert.Equal(t, "168h", flags.Lookup("vsa-expiration").DefValue)
107 assert.Equal(t, "false", flags.Lookup("ignore-signature-verification").DefValue)
108 assert.Equal(t, "true", flags.Lookup("strict").DefValue)
109 assert.Equal(t, "5", flags.Lookup("workers").DefValue)
110}
111
112func TestNewValidateVSACmd_ArgsValidation(t *testing.T) {
113 cmd := NewValidateVSACmd()

Callers

nothing calls this directly

Calls 1

NewValidateVSACmdFunction · 0.85

Tested by

no test coverage detected