github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/state/testing/cloudcredentials.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package testing
     5  
     6  import (
     7  	"github.com/juju/juju/cloud"
     8  	"github.com/juju/juju/state"
     9  )
    10  
    11  // CloudCredential is a convenience method to create state.Credential to be used in unit tests.
    12  func CloudCredential(authType cloud.AuthType, attrs map[string]string) state.Credential {
    13  	c := state.Credential{}
    14  	c.AuthType = string(authType)
    15  	c.Attributes = attrs
    16  	return c
    17  }
    18  
    19  // NewEmptyCredential is a convenience method to create an empty state.Credential
    20  // with a cloud.EmptyAuthType as auth type to be used in unit tests.
    21  func NewEmptyCredential() state.Credential {
    22  	c := state.Credential{}
    23  	c.AuthType = string(cloud.EmptyAuthType)
    24  	return c
    25  }