7
. "launchpad.net/gocheck"
7
gc "launchpad.net/gocheck"
8
8
"launchpad.net/juju-core/charm"
9
9
jujutesting "launchpad.net/juju-core/juju/testing"
10
10
"launchpad.net/juju-core/testing"
14
14
jujutesting.RepoSuite
17
var _ = Suite(&UnexposeSuite{})
17
var _ = gc.Suite(&UnexposeSuite{})
19
func runUnexpose(c *C, args ...string) error {
19
func runUnexpose(c *gc.C, args ...string) error {
20
20
_, err := testing.RunCommand(c, &UnexposeCommand{}, args)
24
func (s *UnexposeSuite) assertExposed(c *C, service string, expected bool) {
24
func (s *UnexposeSuite) assertExposed(c *gc.C, service string, expected bool) {
25
25
svc, err := s.State.Service(service)
26
c.Assert(err, gc.IsNil)
27
27
actual := svc.IsExposed()
28
c.Assert(actual, Equals, expected)
28
c.Assert(actual, gc.Equals, expected)
31
func (s *UnexposeSuite) TestUnexpose(c *C) {
31
func (s *UnexposeSuite) TestUnexpose(c *gc.C) {
32
32
testing.Charms.BundlePath(s.SeriesPath, "dummy")
33
33
err := runDeploy(c, "local:dummy", "some-service-name")
34
c.Assert(err, gc.IsNil)
35
35
curl := charm.MustParseURL("local:precise/dummy-1")
36
36
s.AssertService(c, "some-service-name", curl, 1, 0)
38
38
err = runExpose(c, "some-service-name")
39
c.Assert(err, gc.IsNil)
40
40
s.assertExposed(c, "some-service-name", true)
42
42
err = runUnexpose(c, "some-service-name")
43
c.Assert(err, gc.IsNil)
44
44
s.assertExposed(c, "some-service-name", false)
46
46
err = runUnexpose(c, "nonexistent-service")
47
c.Assert(err, ErrorMatches, `service "nonexistent-service" not found`)
47
c.Assert(err, gc.ErrorMatches, `service "nonexistent-service" not found`)