MCPcopy
hub / github.com/getsops/sops / TestDecodeJSONArrayOfObjects

Function TestDecodeJSONArrayOfObjects

stores/json/store_test.go:235–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

233}
234
235func TestDecodeJSONArrayOfObjects(t *testing.T) {
236 in := `{"foo": [{"bar": "foo"}, {"foo": "bar"}]}`
237 expected := sops.TreeBranch{
238 sops.TreeItem{
239 Key: "foo",
240 Value: []interface{}{
241 sops.TreeBranch{
242 sops.TreeItem{
243 Key: "bar",
244 Value: "foo",
245 },
246 },
247 sops.TreeBranch{
248 sops.TreeItem{
249 Key: "foo",
250 Value: "bar",
251 },
252 },
253 },
254 },
255 }
256 branch, err := Store{}.treeBranchFromJSON([]byte(in))
257 assert.Nil(t, err)
258 assert.Equal(t, expected, branch)
259}
260
261func TestDecodeJSONArrayOfArrays(t *testing.T) {
262 in := `{"foo": [[["foo", {"bar": "foo"}]]]}`

Callers

nothing calls this directly

Calls 1

treeBranchFromJSONMethod · 0.80

Tested by

no test coverage detected