From bbb45dc081444bc108edafaa6c32bb5329444ae4 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 15 Dec 2019 22:48:33 +0100 Subject: [PATCH] nsscash: main_test: add disabled test case for todo --- main_test.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/main_test.go b/main_test.go index 3584537..ca03fc8 100644 --- a/main_test.go +++ b/main_test.go @@ -216,6 +216,7 @@ func TestMainFetch(t *testing.T) { fetchCannotDeploy, fetchSecondFetchFails, fetchBasicAuth, + // TODO: fetchCannotDeployMultiple, } // HTTP tests @@ -966,3 +967,52 @@ ca = "%[4]s" mustNotExist(t, statePath, plainPath, groupPath) mustBeOld(t, passwdPath) } + +/* +TODO: implement code for this test + +func fetchCannotDeployMultiple(a args) { + t := a.t + newPlainDir := "testdata/x" + newPlainPath := newPlainDir + "/plain" + mustWriteConfig(t, fmt.Sprintf(` +statepath = "%[1]s" + +[[file]] +type = "group" +url = "%[2]s/group" +path = "%[3]s" + +[[file]] +type = "plain" +url = "%[2]s/plain" +path = "%[4]s" +`, statePath, a.url, groupPath, newPlainPath)) + os.Mkdir(newPlainDir, 0755) + defer os.RemoveAll(newPlainDir) + mustCreate(t, groupPath) + mustCreate(t, newPlainPath) + mustHaveHash(t, groupPath, "da39a3ee5e6b4b0d3255bfef95601890afd80709") + + *a.handler = func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/group" { + fmt.Fprintln(w, "root:x:0:") + } + if r.URL.Path == "/plain" { + fmt.Fprintln(w, "some file") + } + } + + err := os.Chmod(newPlainDir, 0500) + if err != nil { + t.Fatal(err) + } + + err = mainFetch(configPath) + mustBeErrorWithSubstring(t, err, + "permission denied") + + mustNotExist(t, statePath, passwdPath, plainPath) + mustBeOld(t, groupPath, newPlainPath) +} +*/ -- 2.45.2