1
package simplestreams_test
6
jc "github.com/juju/testing/checkers"
9
"github.com/juju/juju/environs/simplestreams"
12
type jsonSuite struct{}
14
func (s *jsonSuite) TestItemCollectionMarshalling(c *gc.C) {
15
// Ensure that unmarshalling a simplestreams.ItemCollection
16
// directly (not through ParseCloudMetadata) doesn't
17
// cause any surprises.
18
var m simplestreams.ItemCollection
19
m.Items = make(map[string]interface{})
20
err := json.Unmarshal([]byte(`{
26
c.Assert(err, jc.ErrorIsNil)
27
c.Assert(m.Items, gc.DeepEquals, map[string]interface{}{
31
// Ensure marshalling works as expected, too.
32
b, err := json.Marshal(&m)
33
c.Assert(err, jc.ErrorIsNil)
34
c.Assert(string(b), gc.Equals, `{"items":{"a":"b","c":123}}`)