diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-04-25 14:51:49 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-04-25 14:53:28 +0300 |
commit | 6600c754fbb1c3f96cff1c576473935f295ab5cb (patch) | |
tree | 5ecced2d245dbeb0d6b130f81b09c211fad0c846 /internal/testhelpers | |
parent | 950512e00946a5d7df2d82cd6e2a4fe131c90659 (diff) |
Replace os.Setenv with testing.SetEnv
Diffstat (limited to 'internal/testhelpers')
-rw-r--r-- | internal/testhelpers/testhelpers.go | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/internal/testhelpers/testhelpers.go b/internal/testhelpers/testhelpers.go index 2f708743..fdd3e7d4 100644 --- a/internal/testhelpers/testhelpers.go +++ b/internal/testhelpers/testhelpers.go @@ -7,7 +7,6 @@ import ( "net/http/httptest" "net/url" "os" - "strconv" "testing" "github.com/sirupsen/logrus" @@ -63,24 +62,6 @@ func Getwd(t *testing.T) string { return wd } -// SetEnvironmentVariable for testing, restoring the original value on t.Cleanup -func SetEnvironmentVariable(t testing.TB, key, value string) { - t.Helper() - - orig := os.Getenv(key) - - err := os.Setenv(key, value) - require.NoError(t, err) - - t.Cleanup(func() { - require.NoError(t, os.Setenv(key, orig)) - }) -} - -func StubFeatureFlagValue(t testing.TB, envVar string, value bool) { - SetEnvironmentVariable(t, envVar, strconv.FormatBool(value)) -} - func PerformRequest(t *testing.T, handler http.Handler, r *http.Request) (int, string) { t.Helper() |