BeforeEach(func() {
		username = os.Getenv("SL_USERNAME")
		Expect(username).ToNot(Equal(""), "username cannot be empty, set SL_USERNAME")

		apiKey = os.Getenv("SL_API_KEY")
		Expect(apiKey).ToNot(Equal(""), "apiKey cannot be empty, set SL_API_KEY")

		client = slclient.NewSoftLayerClient(username, apiKey)
		Expect(client).ToNot(BeNil())

		pwd, err := os.Getwd()
		Expect(err).ToNot(HaveOccurred())
		rootTemplatePath = filepath.Join(pwd, "..", "..")

		tmpConfigPath, err = testhelperscpi.CreateTmpConfigPath(rootTemplatePath, configPath, username, apiKey)
		Expect(err).ToNot(HaveOccurred())
	})

	AfterEach(func() {
		err = os.RemoveAll(tmpConfigPath)
		Expect(err).ToNot(HaveOccurred())
	})

	Context("delete_stemcell in SoftLayer", func() {
		BeforeEach(func() {
			swiftUsername := strings.Split(os.Getenv("SWIFT_USERNAME"), ":")[0]
			Expect(swiftUsername).ToNot(Equal(""), "swiftUsername cannot be empty, set SWIFT_USERNAME")

			swiftCluster := os.Getenv("SWIFT_CLUSTER")
			Expect(swiftCluster).ToNot(Equal(""), "swiftCluster cannot be empty, set SWIFT_CLUSTER")
	BeforeEach(func() {
		replacementMap = map[string]string{
			"ID":             "some ID",
			"DirectorUuid":   "some director UUID",
			"Tag_deployment": "fake_deployment",
			"Tag_compiling":  "fake_compiling",
		}

		pwd, err := os.Getwd()
		Expect(err).ToNot(HaveOccurred())
		rootTemplatePath = filepath.Join(pwd, "..")
	})

	Context("#CreateTmpConfigPath", func() {
		It("creates a config.json in temp dir with new config template values", func() {
			tmpConfigPath, err := testhelpers.CreateTmpConfigPath(rootTemplatePath, "test_fixtures/cpi_methods/config.json", "some username", "some ApiKey")
			Expect(err).ToNot(HaveOccurred())

			fileInfo, err := os.Stat(tmpConfigPath)
			Expect(err).ToNot(HaveOccurred())
			Expect(fileInfo.Mode().IsRegular()).To(BeTrue())

			err = os.RemoveAll(tmpConfigPath)
			Expect(err).ToNot(HaveOccurred())
		})
	})

	Context("#GenerateCpiJsonPayload", func() {
		Context("set_vm_metadata CPI method", func() {
			BeforeEach(func() {
				cpiTemplate = testhelpers.CpiTemplate{