1
// Copyright 2015 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"github.com/juju/errors"
8
jc "github.com/juju/testing/checkers"
11
"github.com/juju/juju/api/block"
12
jujutesting "github.com/juju/juju/juju/testing"
13
"github.com/juju/juju/state"
16
type blockSuite struct {
17
jujutesting.JujuConnSuite
18
blockClient *block.Client
21
func (s *blockSuite) SetUpTest(c *gc.C) {
22
s.JujuConnSuite.SetUpTest(c)
23
s.blockClient = block.NewClient(s.APIState)
24
c.Assert(s.blockClient, gc.NotNil)
25
s.AddCleanup(func(*gc.C) {
26
s.blockClient.ClientFacade.Close()
30
func (s *blockSuite) TestBlockFacadeCall(c *gc.C) {
31
found, err := s.blockClient.List()
32
c.Assert(err, jc.ErrorIsNil)
33
c.Assert(found, gc.HasLen, 0)
36
func (s *blockSuite) TestBlockFacadeCallGettingErrors(c *gc.C) {
37
err := s.blockClient.SwitchBlockOff(state.DestroyBlock.String())
38
c.Assert(errors.Cause(err), gc.ErrorMatches, `.*is already OFF.*`)