forked from jontours/vars-to-credhub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransformer_test.go
47 lines (37 loc) · 1.03 KB
/
transformer_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"os"
"testing"
. "github.com/onsi/gomega"
"github.com/sclevine/spec"
"gopkg.in/yaml.v2"
)
func TestTransformer(t *testing.T) {
spec.Run(t, "Transformer", func(t *testing.T, when spec.G, it spec.S) {
var input map[interface{}]interface{}
var output BulkImport
it.Before(func() {
RegisterTestingT(t)
file, _ := os.Open("fixtures/input.yml")
inputDecoder := yaml.NewDecoder(file)
inputDecoder.Decode(&input)
file, _ = os.Open("fixtures/output.yml")
outputDecoder := yaml.NewDecoder(file)
outputDecoder.Decode(&output)
})
when("Doing an ETL", func() {
it("Imported the input yml successfully", func() {
Expect(len(input)).To(Equal(9))
})
it("Imported the output yml successfully", func() {
Expect(len(output.Credentials)).To(Equal(9))
})
it("Transformed the output correctly", func() {
file, _ := os.Open("fixtures/input.yml")
out, err := Transform("/foo", file)
Expect(err).To(BeNil())
Expect(len(out.Credentials)).To(Equal(9))
})
})
})
}