github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/state/utils/fakes_test.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package utils_test
     5  
     6  import (
     7  	"github.com/juju/errors"
     8  
     9  	"github.com/juju/juju/environs"
    10  	"github.com/juju/juju/instance"
    11  	"github.com/juju/juju/provider/common"
    12  )
    13  
    14  // fakeZonedEnv wraps an Environ (e.g. dummy) and implements ZonedEnviron.
    15  type fakeZonedEnv struct {
    16  	environs.Environ
    17  
    18  	zones     []common.AvailabilityZone
    19  	instZones []string
    20  	err       error
    21  
    22  	calls  []string
    23  	idsArg []instance.Id
    24  }
    25  
    26  // AvailabilityZones implements ZonedEnviron.
    27  func (e *fakeZonedEnv) AvailabilityZones() ([]common.AvailabilityZone, error) {
    28  	e.calls = append(e.calls, "AvailabilityZones")
    29  	return e.zones, errors.Trace(e.err)
    30  }
    31  
    32  // InstanceAvailabilityZoneNames implements ZonedEnviron.
    33  func (e *fakeZonedEnv) InstanceAvailabilityZoneNames(ids []instance.Id) ([]string, error) {
    34  	e.calls = append(e.calls, "InstanceAvailabilityZoneNames")
    35  	e.idsArg = ids
    36  	return e.instZones, errors.Trace(e.err)
    37  }