add test resource_test for Signature
@@ -4,6 +4,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ "github.com/concourse/concourse/atc"
. "github.com/concourse/concourse/atc/resource"
)
@@ -13,4 +14,38 @@ var _ = Describe("Resource", func() {
Expect(ResourcesDir("some-prefix")).To(ContainSubstring("some-prefix"))
})
})
+
+ Describe("Signature", func(){
+ var (
+ resource Resource
+ source atc.Source
+ params atc.Params
+ version atc.Version
+
+ )
+
+ BeforeEach(func(){
+ source = atc.Source{ "some-source-key": "some-source-value"}
+ params = atc.Params{ "some-params-key": "some-params-value"}
+ version = atc.Version{ "some-version-key": "some-version-value"}
+
+ resource = NewResourceFactory().NewResource(source, params, version)
+ })
+
+ It("marshals the source, params and version", func(){
+ actualSignature, err := resource.Signature()
+ Expect(err).ToNot(HaveOccurred())
+ Expect(actualSignature).To(MatchJSON(`{
+ "source": {
+ "some-source-key": "some-source-value"
+ },
+ "params": {
+ "some-params-key": "some-params-value"
+ },
+ "version": {
+ "some-version-key": "some-version-value"
+ }
+ }`))
+ })
+ })
})
