github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/cmd/juju/storage/export_test.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package storage
     5  
     6  import (
     7  	"github.com/juju/cmd"
     8  
     9  	"github.com/juju/juju/cmd/modelcmd"
    10  	"github.com/juju/juju/jujuclient"
    11  )
    12  
    13  var (
    14  	ConvertToVolumeInfo     = convertToVolumeInfo
    15  	ConvertToFilesystemInfo = convertToFilesystemInfo
    16  )
    17  
    18  func NewPoolListCommandForTest(api PoolListAPI, store jujuclient.ClientStore) cmd.Command {
    19  	cmd := &poolListCommand{newAPIFunc: func() (PoolListAPI, error) {
    20  		return api, nil
    21  	}}
    22  	cmd.SetClientStore(store)
    23  	return modelcmd.Wrap(cmd)
    24  }
    25  
    26  func NewPoolCreateCommandForTest(api PoolCreateAPI, store jujuclient.ClientStore) cmd.Command {
    27  	cmd := &poolCreateCommand{newAPIFunc: func() (PoolCreateAPI, error) {
    28  		return api, nil
    29  	}}
    30  	cmd.SetClientStore(store)
    31  	return modelcmd.Wrap(cmd)
    32  }
    33  
    34  func NewPoolRemoveCommandForTest(api PoolRemoveAPI, store jujuclient.ClientStore) cmd.Command {
    35  	cmd := &poolRemoveCommand{newAPIFunc: func() (PoolRemoveAPI, error) {
    36  		return api, nil
    37  	}}
    38  	cmd.SetClientStore(store)
    39  	return modelcmd.Wrap(cmd)
    40  }
    41  
    42  func NewPoolUpdateCommandForTest(api PoolUpdateAPI, store jujuclient.ClientStore) cmd.Command {
    43  	cmd := &poolUpdateCommand{newAPIFunc: func() (PoolUpdateAPI, error) {
    44  		return api, nil
    45  	}}
    46  	cmd.SetClientStore(store)
    47  	return modelcmd.Wrap(cmd)
    48  }
    49  
    50  func NewShowCommandForTest(api StorageShowAPI, store jujuclient.ClientStore) cmd.Command {
    51  	cmd := &showCommand{newAPIFunc: func() (StorageShowAPI, error) {
    52  		return api, nil
    53  	}}
    54  	cmd.SetClientStore(store)
    55  	return modelcmd.Wrap(cmd)
    56  }
    57  
    58  func NewListCommandForTest(api StorageListAPI, store jujuclient.ClientStore) cmd.Command {
    59  	cmd := &listCommand{newAPIFunc: func() (StorageListAPI, error) {
    60  		return api, nil
    61  	}}
    62  	cmd.SetClientStore(store)
    63  	return modelcmd.Wrap(cmd)
    64  }
    65  
    66  func NewAddCommandForTest(api StorageAddAPI, store jujuclient.ClientStore) cmd.Command {
    67  	cmd := &addCommand{newAPIFunc: func() (StorageAddAPI, error) {
    68  		return api, nil
    69  	}}
    70  	cmd.SetClientStore(store)
    71  	return modelcmd.Wrap(cmd)
    72  }
    73  
    74  func NewRemoveStorageCommandForTest(new NewStorageRemoverCloserFunc, store jujuclient.ClientStore) cmd.Command {
    75  	cmd := &removeStorageCommand{}
    76  	cmd.SetClientStore(store)
    77  	cmd.newStorageRemoverCloser = new
    78  	return modelcmd.Wrap(cmd)
    79  }
    80  
    81  func NewAttachStorageCommandForTest(new NewEntityAttacherCloserFunc, store jujuclient.ClientStore) cmd.Command {
    82  	cmd := &attachStorageCommand{}
    83  	cmd.SetClientStore(store)
    84  	cmd.newEntityAttacherCloser = new
    85  	return modelcmd.Wrap(cmd)
    86  }
    87  
    88  func NewDetachStorageCommandForTest(new NewEntityDetacherCloserFunc, store jujuclient.ClientStore) cmd.Command {
    89  	cmd := &detachStorageCommand{}
    90  	cmd.SetClientStore(store)
    91  	cmd.newEntityDetacherCloser = new
    92  	return modelcmd.Wrap(cmd)
    93  }