github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/cmd/juju/block/package_test.go (about) 1 // Copyright 2012, 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package block_test 5 6 import ( 7 gc "gopkg.in/check.v1" 8 stdtesting "testing" 9 10 "github.com/juju/juju/cmd/juju/block" 11 "github.com/juju/juju/testing" 12 ) 13 14 func TestAll(t *stdtesting.T) { 15 testing.MgoTestPackage(t) 16 } 17 18 type ProtectionCommandSuite struct { 19 testing.FakeJujuHomeSuite 20 mockClient *mockClient 21 } 22 23 func (s *ProtectionCommandSuite) assertErrorMatches(c *gc.C, err error, expected string) { 24 c.Assert( 25 err, 26 gc.ErrorMatches, 27 expected) 28 } 29 30 func (s *ProtectionCommandSuite) SetUpTest(c *gc.C) { 31 s.FakeJujuHomeSuite.SetUpTest(c) 32 s.mockClient = &mockClient{} 33 s.PatchValue(block.ClientGetter, func(p *block.ProtectionCommand) (block.ClientAPI, error) { 34 return s.mockClient, nil 35 }) 36 } 37 38 type mockClient struct { 39 cfg map[string]interface{} 40 } 41 42 func (c *mockClient) Close() error { 43 return nil 44 } 45 46 func (c *mockClient) EnvironmentSet(attrs map[string]interface{}) error { 47 c.cfg = attrs 48 return nil 49 }