github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/state/dump_test.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package state_test 5 6 import ( 7 jc "github.com/juju/testing/checkers" 8 "github.com/juju/utils/set" 9 gc "gopkg.in/check.v1" 10 ) 11 12 type dumpSuite struct { 13 ConnSuite 14 } 15 16 var _ = gc.Suite(&dumpSuite{}) 17 18 func (s *dumpSuite) TestDumpAll(c *gc.C) { 19 value, err := s.State.DumpAll() 20 c.Assert(err, jc.ErrorIsNil) 21 22 models, ok := value["models"].(map[string]interface{}) 23 c.Assert(ok, jc.IsTrue) 24 c.Assert(models["name"], gc.Equals, "testenv") 25 26 initialCollections := set.NewStrings() 27 for name := range value { 28 initialCollections.Add(name) 29 } 30 // check that there are some other collections there 31 c.Check(initialCollections.Contains("modelusers"), jc.IsTrue) 32 c.Check(initialCollections.Contains("leases"), jc.IsTrue) 33 c.Check(initialCollections.Contains("statuses"), jc.IsTrue) 34 }