github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/juju/cloud/export_test.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package cloud
     5  
     6  import (
     7  	jujucloud "github.com/juju/juju/cloud"
     8  	sstesting "github.com/juju/juju/environs/simplestreams/testing"
     9  	"github.com/juju/juju/jujuclient"
    10  )
    11  
    12  func NewUpdateCloudsCommandForTest(publicCloudURL string) *updateCloudsCommand {
    13  	return &updateCloudsCommand{
    14  		// TODO(wallyworld) - move testing key elsewhere
    15  		publicSigningKey: sstesting.SignedMetadataPublicKey,
    16  		publicCloudURL:   publicCloudURL,
    17  	}
    18  }
    19  
    20  func NewListCredentialsCommandForTest(
    21  	testStore jujuclient.CredentialGetter,
    22  	personalCloudsFunc func() (map[string]jujucloud.Cloud, error),
    23  	cloudByNameFunc func(string) (*jujucloud.Cloud, error),
    24  ) *listCredentialsCommand {
    25  	return &listCredentialsCommand{
    26  		store:              testStore,
    27  		personalCloudsFunc: personalCloudsFunc,
    28  		cloudByNameFunc:    cloudByNameFunc,
    29  	}
    30  }
    31  
    32  func NewDetectCredentialsCommandForTest(
    33  	testStore jujuclient.CredentialStore,
    34  	registeredProvidersFunc func() []string,
    35  	allCloudsFunc func() (map[string]jujucloud.Cloud, error),
    36  	cloudsByNameFunc func(string) (*jujucloud.Cloud, error),
    37  ) *detectCredentialsCommand {
    38  	return &detectCredentialsCommand{
    39  		store: testStore,
    40  		registeredProvidersFunc: registeredProvidersFunc,
    41  		allCloudsFunc:           allCloudsFunc,
    42  		cloudByNameFunc:         cloudsByNameFunc,
    43  	}
    44  }
    45  
    46  func NewAddCredentialCommandForTest(
    47  	testStore jujuclient.CredentialStore,
    48  	cloudByNameFunc func(string) (*jujucloud.Cloud, error),
    49  ) *addCredentialCommand {
    50  	return &addCredentialCommand{
    51  		store:           testStore,
    52  		cloudByNameFunc: cloudByNameFunc,
    53  	}
    54  }
    55  
    56  func NewRemoveCredentialCommandForTest(testStore jujuclient.CredentialStore) *removeCredentialCommand {
    57  	return &removeCredentialCommand{
    58  		store: testStore,
    59  	}
    60  }
    61  
    62  func NewSetDefaultCredentialCommandForTest(testStore jujuclient.CredentialStore) *setDefaultCredentialCommand {
    63  	return &setDefaultCredentialCommand{
    64  		store: testStore,
    65  	}
    66  }
    67  
    68  func NewSetDefaultRegionCommandForTest(testStore jujuclient.CredentialStore) *setDefaultRegionCommand {
    69  	return &setDefaultRegionCommand{
    70  		store: testStore,
    71  	}
    72  }