From fa997525c2e156e54f0540f08c607999ff4ff886 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 13 Sep 2014 18:58:21 -0700 Subject: [PATCH] config/module: Get tests --- config/module/get_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 config/module/get_test.go diff --git a/config/module/get_test.go b/config/module/get_test.go new file mode 100644 index 0000000000..94d131a3df --- /dev/null +++ b/config/module/get_test.go @@ -0,0 +1,32 @@ +package module + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestGet_badSchema(t *testing.T) { + dst := tempDir(t) + u := testModule("basic") + u = strings.Replace(u, "file", "nope", -1) + + if err := Get(dst, u); err == nil { + t.Fatal("should error") + } +} + +func TestGet_file(t *testing.T) { + dst := tempDir(t) + u := testModule("basic") + + if err := Get(dst, u); err != nil { + t.Fatalf("err: %s", err) + } + + mainPath := filepath.Join(dst, "main.tf") + if _, err := os.Stat(mainPath); err != nil { + t.Fatalf("err: %s", err) + } +}