github.com/loafoe/cli@v7.1.0+incompatible/integration/shared/plugin/install_plugin_command_unix_test.go (about)

     1  // +build !windows
     2  
     3  package plugin
     4  
     5  import (
     6  	"os"
     7  	"path/filepath"
     8  
     9  	"code.cloudfoundry.org/cli/integration/helpers"
    10  	. "github.com/onsi/ginkgo"
    11  	. "github.com/onsi/gomega"
    12  	. "github.com/onsi/gomega/gexec"
    13  )
    14  
    15  var _ = Describe("install-plugin command", func() {
    16  	Context("installing a plugin from a local file", func() {
    17  		var pluginPath string
    18  
    19  		BeforeEach(func() {
    20  			pluginPath = helpers.BuildConfigurablePlugin("configurable_plugin", "some-plugin", "1.0.0",
    21  				[]helpers.PluginCommand{
    22  					{Name: "some-command", Help: "some-command-help"},
    23  				},
    24  			)
    25  		})
    26  
    27  		When("the -f flag is given", func() {
    28  			It("sets the installed plugin's permissions to 0755", func() {
    29  				session := helpers.CF("install-plugin", pluginPath, "-f")
    30  				Eventually(session).Should(Exit(0))
    31  
    32  				installedPath := filepath.Join(homeDir, ".cf", "plugins", "some-plugin")
    33  				stat, err := os.Stat(installedPath)
    34  				Expect(err).ToNot(HaveOccurred())
    35  				Expect(stat.Mode()).To(Equal(os.FileMode(0755)))
    36  			})
    37  		})
    38  	})
    39  })