github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/creds/source_test.go (about)

     1  package creds_test
     2  
     3  import (
     4  	"github.com/pf-qiu/concourse/v6/atc"
     5  	"github.com/pf-qiu/concourse/v6/atc/creds"
     6  	"github.com/pf-qiu/concourse/v6/vars"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("Evaluate", func() {
    13  	var source creds.Source
    14  
    15  	BeforeEach(func() {
    16  		variables := vars.StaticVariables{
    17  			"some-param": "lol",
    18  		}
    19  		source = creds.NewSource(variables, atc.Source{
    20  			"some": map[string]interface{}{
    21  				"source-key": "((some-param))",
    22  			},
    23  		})
    24  	})
    25  
    26  	Describe("Evaluate", func() {
    27  		It("parses variables", func() {
    28  			result, err := source.Evaluate()
    29  			Expect(err).NotTo(HaveOccurred())
    30  
    31  			Expect(result).To(Equal(atc.Source{
    32  				"some": map[string]interface{}{
    33  					"source-key": "lol",
    34  				},
    35  			}))
    36  		})
    37  	})
    38  })