Skip to content

Commit 9e40785

Browse files
committed
Remove useless test funcs
1 parent a7f29de commit 9e40785

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

internal/config/config_test.go

+6-32
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,14 @@ import (
2828

2929
func TestRetrieve(t *testing.T) {
3030
var (
31-
validSecret = "qaRZGEbnQNNvmaeTLqy8Bxs22wLZ6H7obIiNSveTLPdoQuylANnuy6WBOw16XoqH"
32-
validClient = "CQ4iZ5sebOfhGRwUn3IV0r1YFMNrMTIx"
33-
validConfig = &Config{validClient, validSecret}
34-
invalidConfig = &Config{"", validSecret}
35-
clientEnv = EnvPrefix + "_CLIENT"
36-
secretEnv = EnvPrefix + "_SECRET"
37-
clientEnvBackup *string
38-
secretEnvBackup *string
31+
validSecret = "qaRZGEbnQNNvmaeTLqy8Bxs22wLZ6H7obIiNSveTLPdoQuylANnuy6WBOw16XoqH"
32+
validClient = "CQ4iZ5sebOfhGRwUn3IV0r1YFMNrMTIx"
33+
validConfig = &Config{validClient, validSecret}
34+
invalidConfig = &Config{"", validSecret}
35+
clientEnv = EnvPrefix + "_CLIENT"
36+
secretEnv = EnvPrefix + "_SECRET"
3937
)
4038

41-
// Preserve user environment variables when executing this test
42-
_ = func() {
43-
if c, ok := os.LookupEnv(clientEnv); ok {
44-
clientEnvBackup = &c
45-
}
46-
if s, ok := os.LookupEnv(secretEnv); ok {
47-
secretEnvBackup = &s
48-
}
49-
}
50-
_ = func() {
51-
if clientEnvBackup != nil {
52-
os.Setenv(clientEnv, *clientEnvBackup)
53-
clientEnvBackup = nil
54-
}
55-
if secretEnvBackup != nil {
56-
os.Setenv(secretEnv, *secretEnvBackup)
57-
secretEnvBackup = nil
58-
}
59-
}
60-
6139
tests := []struct {
6240
name string
6341
pre func()
@@ -68,14 +46,12 @@ func TestRetrieve(t *testing.T) {
6846
{
6947
name: "valid config written in env",
7048
pre: func() {
71-
// pushEnv()
7249
os.Setenv(clientEnv, validConfig.Client)
7350
os.Setenv(secretEnv, validConfig.Secret)
7451
},
7552
post: func() {
7653
os.Unsetenv(clientEnv)
7754
os.Unsetenv(secretEnv)
78-
// popEnv()
7955
},
8056
wantedConfig: validConfig,
8157
wantedErr: false,
@@ -84,14 +60,12 @@ func TestRetrieve(t *testing.T) {
8460
{
8561
name: "invalid config written in env",
8662
pre: func() {
87-
// pushEnv()
8863
os.Setenv(clientEnv, validConfig.Client)
8964
os.Setenv(secretEnv, "")
9065
},
9166
post: func() {
9267
os.Unsetenv(clientEnv)
9368
os.Unsetenv(secretEnv)
94-
// popEnv()
9569
},
9670
wantedConfig: nil,
9771
wantedErr: true,

0 commit comments

Comments
 (0)