OLD | NEW |
1 package state_test | 1 package state_test |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 "labix.org/v2/mgo/bson" | 5 "labix.org/v2/mgo/bson" |
6 . "launchpad.net/gocheck" | 6 . "launchpad.net/gocheck" |
7 "launchpad.net/juju-core/charm" | 7 "launchpad.net/juju-core/charm" |
8 "launchpad.net/juju-core/environs/config" | 8 "launchpad.net/juju-core/environs/config" |
9 "launchpad.net/juju-core/state" | 9 "launchpad.net/juju-core/state" |
10 "launchpad.net/juju-core/testing" | 10 "launchpad.net/juju-core/testing" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 func (s *StateSuite) TestStateInfo(c *C) { | 34 func (s *StateSuite) TestStateInfo(c *C) { |
35 info := state.TestingStateInfo() | 35 info := state.TestingStateInfo() |
36 c.Assert(s.State.Addrs(), DeepEquals, info.Addrs) | 36 c.Assert(s.State.Addrs(), DeepEquals, info.Addrs) |
37 c.Assert(s.State.CACert(), DeepEquals, info.CACert) | 37 c.Assert(s.State.CACert(), DeepEquals, info.CACert) |
38 } | 38 } |
39 | 39 |
40 func (s *StateSuite) TestIsNotFound(c *C) { | 40 func (s *StateSuite) TestIsNotFound(c *C) { |
41 err1 := fmt.Errorf("unrelated error") | 41 err1 := fmt.Errorf("unrelated error") |
42 » err2 := &state.NotFoundError{} | 42 » err2 := state.NotFoundf("foo") |
43 c.Assert(state.IsNotFound(err1), Equals, false) | 43 c.Assert(state.IsNotFound(err1), Equals, false) |
44 c.Assert(state.IsNotFound(err2), Equals, true) | 44 c.Assert(state.IsNotFound(err2), Equals, true) |
45 } | 45 } |
46 | 46 |
47 func (s *StateSuite) TestAddCharm(c *C) { | 47 func (s *StateSuite) TestAddCharm(c *C) { |
48 // Check that adding charms from scratch works correctly. | 48 // Check that adding charms from scratch works correctly. |
49 ch := testing.Charms.Dir("dummy") | 49 ch := testing.Charms.Dir("dummy") |
50 curl := charm.MustParseURL( | 50 curl := charm.MustParseURL( |
51 fmt.Sprintf("local:series/%s-%d", ch.Meta().Name, ch.Revision())
, | 51 fmt.Sprintf("local:series/%s-%d", ch.Meta().Name, ch.Revision())
, |
52 ) | 52 ) |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 c.Assert(e.EntityName(), Equals, u.EntityName()) | 1296 c.Assert(e.EntityName(), Equals, u.EntityName()) |
1297 | 1297 |
1298 user, err := s.State.AddUser("arble", "pass") | 1298 user, err := s.State.AddUser("arble", "pass") |
1299 c.Assert(err, IsNil) | 1299 c.Assert(err, IsNil) |
1300 | 1300 |
1301 e, err = s.State.AuthEntity(user.EntityName()) | 1301 e, err = s.State.AuthEntity(user.EntityName()) |
1302 c.Assert(err, IsNil) | 1302 c.Assert(err, IsNil) |
1303 c.Assert(e, FitsTypeOf, user) | 1303 c.Assert(e, FitsTypeOf, user) |
1304 c.Assert(e.EntityName(), Equals, user.EntityName()) | 1304 c.Assert(e.EntityName(), Equals, user.EntityName()) |
1305 } | 1305 } |
OLD | NEW |