~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/featuretests/block_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2015 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package featuretests
 
5
 
 
6
import (
 
7
        "github.com/juju/errors"
 
8
        jc "github.com/juju/testing/checkers"
 
9
        gc "gopkg.in/check.v1"
 
10
 
 
11
        "github.com/juju/juju/api/block"
 
12
        jujutesting "github.com/juju/juju/juju/testing"
 
13
        "github.com/juju/juju/state"
 
14
)
 
15
 
 
16
type blockSuite struct {
 
17
        jujutesting.JujuConnSuite
 
18
        blockClient *block.Client
 
19
}
 
20
 
 
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()
 
27
        })
 
28
}
 
29
 
 
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)
 
34
}
 
35
 
 
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.*`)
 
39
}