github.com/sleungcy-sap/cli@v7.1.0+incompatible/actor/v7pushaction/set_default_bits_path_for_push_plan_test.go (about) 1 package v7pushaction_test 2 3 import ( 4 "code.cloudfoundry.org/cli/actor/v7action" 5 . "code.cloudfoundry.org/cli/actor/v7pushaction" 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("SetupBitsPathForPushPlan", func() { 11 var ( 12 pushPlan PushPlan 13 overrides FlagOverrides 14 15 expectedPushPlan PushPlan 16 executeError error 17 ) 18 19 BeforeEach(func() { 20 pushPlan = PushPlan{} 21 overrides = FlagOverrides{} 22 }) 23 24 JustBeforeEach(func() { 25 expectedPushPlan, executeError = SetDefaultBitsPathForPushPlan(pushPlan, overrides) 26 }) 27 28 Describe("Path", func() { 29 When("PushPlan contains a BitPath", func() { 30 BeforeEach(func() { 31 pushPlan.BitsPath = "myPath" 32 }) 33 It("creates a pushPlan with an app with BitsPath set to the currentDir", func() { 34 Expect(executeError).ToNot(HaveOccurred()) 35 Expect(expectedPushPlan.BitsPath).To(Equal("myPath")) 36 }) 37 }) 38 39 When("PushPlan does not contain a BitPath", func() { 40 When("Pushplan does not have droplet or docker", func() { 41 It("creates a pushPlan with an app with BitsPath set to the currentDir", func() { 42 Expect(executeError).ToNot(HaveOccurred()) 43 Expect(expectedPushPlan.BitsPath).To(Equal(getCurrentDir())) 44 }) 45 }) 46 47 When("Pushplan has droplet", func() { 48 BeforeEach(func() { 49 pushPlan.DropletPath = "some-path" 50 }) 51 52 It("does not set the BitsPath on the push plan", func() { 53 Expect(executeError).ToNot(HaveOccurred()) 54 Expect(expectedPushPlan.BitsPath).To(Equal("")) 55 }) 56 }) 57 58 When("Pushplan has docker", func() { 59 BeforeEach(func() { 60 pushPlan.DockerImageCredentials = v7action.DockerImageCredentials{ 61 Path: "some-path", 62 Username: "", 63 Password: "", 64 } 65 }) 66 67 It("does not set the BitsPath on the push plan", func() { 68 Expect(executeError).ToNot(HaveOccurred()) 69 Expect(expectedPushPlan.BitsPath).To(Equal("")) 70 }) 71 }) 72 73 }) 74 }) 75 })