LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2012, 2013 Canonical Ltd. | 1 // Copyright 2012, 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package state_test | 4 package state_test |
5 | 5 |
6 import ( | 6 import ( |
7 stdtesting "testing" | 7 stdtesting "testing" |
8 | 8 |
9 "labix.org/v2/mgo" | 9 "labix.org/v2/mgo" |
10 gc "launchpad.net/gocheck" | 10 gc "launchpad.net/gocheck" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 cs.MgoSuite.SetUpTest(c) | 52 cs.MgoSuite.SetUpTest(c) |
53 cs.policy = mockPolicy{} | 53 cs.policy = mockPolicy{} |
54 cs.State = state.TestingInitialize(c, nil, &cs.policy) | 54 cs.State = state.TestingInitialize(c, nil, &cs.policy) |
55 cs.annotations = cs.MgoSuite.Session.DB("juju").C("annotations") | 55 cs.annotations = cs.MgoSuite.Session.DB("juju").C("annotations") |
56 cs.charms = cs.MgoSuite.Session.DB("juju").C("charms") | 56 cs.charms = cs.MgoSuite.Session.DB("juju").C("charms") |
57 cs.machines = cs.MgoSuite.Session.DB("juju").C("machines") | 57 cs.machines = cs.MgoSuite.Session.DB("juju").C("machines") |
58 cs.relations = cs.MgoSuite.Session.DB("juju").C("relations") | 58 cs.relations = cs.MgoSuite.Session.DB("juju").C("relations") |
59 cs.services = cs.MgoSuite.Session.DB("juju").C("services") | 59 cs.services = cs.MgoSuite.Session.DB("juju").C("services") |
60 cs.units = cs.MgoSuite.Session.DB("juju").C("units") | 60 cs.units = cs.MgoSuite.Session.DB("juju").C("units") |
61 cs.stateServers = cs.MgoSuite.Session.DB("juju").C("stateServers") | 61 cs.stateServers = cs.MgoSuite.Session.DB("juju").C("stateServers") |
62 » cs.State.AddUser("admin", "pass") | 62 » cs.State.AddUser(state.AdminUser, "pass") |
63 } | 63 } |
64 | 64 |
65 func (cs *ConnSuite) TearDownTest(c *gc.C) { | 65 func (cs *ConnSuite) TearDownTest(c *gc.C) { |
66 if cs.State != nil { | 66 if cs.State != nil { |
67 // If setup fails, we don't have a State yet | 67 // If setup fails, we don't have a State yet |
68 cs.State.Close() | 68 cs.State.Close() |
69 } | 69 } |
70 cs.MgoSuite.TearDownTest(c) | 70 cs.MgoSuite.TearDownTest(c) |
71 cs.LoggingSuite.TearDownTest(c) | 71 cs.LoggingSuite.TearDownTest(c) |
72 } | 72 } |
(...skipping 26 matching lines...) Expand all Loading... |
99 type mockPolicy struct { | 99 type mockPolicy struct { |
100 getPrechecker func(*config.Config) (state.Prechecker, error) | 100 getPrechecker func(*config.Config) (state.Prechecker, error) |
101 } | 101 } |
102 | 102 |
103 func (p *mockPolicy) Prechecker(cfg *config.Config) (state.Prechecker, error) { | 103 func (p *mockPolicy) Prechecker(cfg *config.Config) (state.Prechecker, error) { |
104 if p.getPrechecker != nil { | 104 if p.getPrechecker != nil { |
105 return p.getPrechecker(cfg) | 105 return p.getPrechecker(cfg) |
106 } | 106 } |
107 return nil, errors.NewNotImplementedError("Prechecker") | 107 return nil, errors.NewNotImplementedError("Prechecker") |
108 } | 108 } |
LEFT | RIGHT |