github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/juju/model/fakeenv_test.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package model_test 5 6 import ( 7 gc "gopkg.in/check.v1" 8 9 "github.com/juju/juju/testing" 10 ) 11 12 type fakeEnvSuite struct { 13 testing.FakeJujuXDGDataHomeSuite 14 fake *fakeEnvAPI 15 } 16 17 func (s *fakeEnvSuite) SetUpTest(c *gc.C) { 18 s.FakeJujuXDGDataHomeSuite.SetUpTest(c) 19 s.fake = &fakeEnvAPI{ 20 values: map[string]interface{}{ 21 "name": "test-model", 22 "special": "special value", 23 "running": true, 24 }, 25 } 26 } 27 28 type fakeEnvAPI struct { 29 values map[string]interface{} 30 err error 31 keys []string 32 } 33 34 func (f *fakeEnvAPI) Close() error { 35 return nil 36 } 37 38 func (f *fakeEnvAPI) ModelGet() (map[string]interface{}, error) { 39 return f.values, nil 40 } 41 42 func (f *fakeEnvAPI) ModelSet(config map[string]interface{}) error { 43 f.values = config 44 return f.err 45 } 46 47 func (f *fakeEnvAPI) ModelUnset(keys ...string) error { 48 f.keys = keys 49 return f.err 50 }