MCPcopy Index your code
hub / github.com/apache/cloudstack-go / TestEncodeValues

Function TestEncodeValues

test/cloudstack_test.go:120–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func TestEncodeValues(t *testing.T) {
121 RegisterFailHandler(Fail)
122
123 DescribeTable("Encoding Values", func(value, expected string) {
124 key := "testvalue"
125 values := url.Values{}
126 values.Set(key, value)
127 Expect(cloudstack.EncodeValues(values)).To(Equal(fmt.Sprintf("%s=%s", key, expected)))
128 },
129 Entry("When asterisk is in value it shouldn't encode asterisk", "*.example.com", "*.example.com"),
130 Entry("When question mark is in value it should encode question mark", "foo?", "foo%3F"),
131 Entry("When question mark and asterisk is in value it should encode only question mark", "*.foo?", "*.foo%3F"),
132 Entry("When a space is involved, should encode to %20 and not a +", "this that", "this%20that"),
133 )
134
135 RunSpecs(t, "Encoding Suite")
136}
137
138type UUIDStruct struct {
139 Value cloudstack.UUID `json:"value"`

Callers

nothing calls this directly

Calls 1

EncodeValuesFunction · 0.92

Tested by

no test coverage detected