From 909299725cb280bfe7cc0abec2330dd5b21aa729 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 22 Jul 2015 22:11:49 -0700 Subject: [PATCH] omaha: embed test data into the test code --- omaha/omaha_test.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/omaha/omaha_test.go b/omaha/omaha_test.go index 5a3eae4..c2f14b7 100644 --- a/omaha/omaha_test.go +++ b/omaha/omaha_test.go @@ -3,22 +3,23 @@ package omaha import ( "encoding/xml" "fmt" - "io/ioutil" - "os" "testing" ) +const SampleRequest = ` + + + + + + + + +` + func TestOmahaRequestUpdateCheck(t *testing.T) { - file, err := os.Open("../fixtures/update-engine/update/request.xml") - if err != nil { - t.Error(err) - } - fix, err := ioutil.ReadAll(file) - if err != nil { - t.Error(err) - } v := Request{} - xml.Unmarshal(fix, &v) + xml.Unmarshal([]byte(SampleRequest), &v) if v.Os.Version != "Indy" { t.Error("Unexpected version", v.Os.Version)