2020-07-26 05:50:18 +02:00
|
|
|
package header
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"path"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
filesDir string
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHeaderSuite(t *testing.T) {
|
|
|
|
logger.SetOutput(GinkgoWriter)
|
2021-02-10 20:50:09 +02:00
|
|
|
logger.SetErrOutput(GinkgoWriter)
|
2020-07-26 05:50:18 +02:00
|
|
|
|
|
|
|
RegisterFailHandler(Fail)
|
|
|
|
RunSpecs(t, "Header")
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ = BeforeSuite(func() {
|
|
|
|
os.Setenv("SECRET_ENV", "super-secret-env")
|
|
|
|
|
|
|
|
dir, err := ioutil.TempDir("", "oauth2-proxy-header-suite")
|
|
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
Expect(ioutil.WriteFile(path.Join(dir, "secret-file"), []byte("super-secret-file"), 0644)).To(Succeed())
|
|
|
|
filesDir = dir
|
|
|
|
})
|
|
|
|
|
|
|
|
var _ = AfterSuite(func() {
|
|
|
|
os.Unsetenv("SECRET_ENV")
|
|
|
|
Expect(os.RemoveAll(filesDir)).To(Succeed())
|
|
|
|
})
|