package runner import ( "slices" "testing" ) // TestPreviewCredentialProtected: the preview credential is one of the // protected paths when it is set (never mounted into, or read from, a // sandbox), and adds nothing when previews are off. func TestPreviewCredentialProtected(t *testing.T) { c := Config{StateDir: "/state", AccountBindingsPath: "/state/bindings.json", AmadanCredentialPath: "/state/amadan.json", PreviewCredentialPath: "/state/preview.json"} if !slices.Contains(c.securityPaths(nil).Credentials(), "/state/preview.json") { t.Fatal("the preview credential is not protected") } c.PreviewCredentialPath = "" for _, p := range c.securityPaths(nil).Credentials() { if p == "" { t.Fatal("an empty protected path") } } }