Beispiel #1
0
			osName = "windows2012r2"
		})
		Describe("Autounattend.xml.template root template", func() {
			var rootTemplate tpl.Templater
			JustBeforeEach(func() {
				rootTemplate = templates.FindTemplate(filepath.Join(tmpDir, "Autounattend.xml.template"))
			})
			It("should be found", func() {
				Expect(rootTemplate).ToNot(BeNil())
			})
			It("should have 2 partial templates", func() {
				Expect(rootTemplate.ListTemplates()).To(HaveLen(2))
			})
			It("should include Autounattend.xml.oobe.partial", func() {
				path := filepath.Join(tmpDir, "Autounattend.xml.oobe.partial")
				Expect(rootTemplate.FindTemplate(path)).ToNot(BeNil())
			})
			It("should include Autounattend.xml.disks.partial", func() {
				path := filepath.Join(tmpDir, "Autounattend.xml.disks.partial")
				Expect(rootTemplate.FindTemplate(path)).ToNot(BeNil())
			})
			It("should have template content", func() {
				expected := `Autounattend.xml.template
{{define "disks"}}
Autounattend.xml.disks.partial
{{end}}
{{define "oobe"}}
Autounattend.xml.oobe.partial
{{end}}`
				var buffer bytes.Buffer
				Expect(rootTemplate.Content(&buffer)).NotTo(HaveOccurred())