Skip to content

Commit

Permalink
client: reset TSURU_TARGET and TSURU_TOKEN for each test
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Feb 23, 2024
1 parent 66974eb commit a13be1a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tsuru/client/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/ajg/form"
"github.com/tsuru/tsuru-client/tsuru/config"
"github.com/tsuru/tsuru-client/tsuru/formatter"
tsuruHTTP "github.com/tsuru/tsuru-client/tsuru/http"
"gopkg.in/check.v1"
Expand All @@ -22,26 +23,24 @@ type S struct {
}

func (s *S) SetUpSuite(c *check.C) {
os.Setenv("TSURU_TARGET", "http://localhost:8080")
os.Setenv("TSURU_TOKEN", "sometoken")
form.DefaultEncoder = form.DefaultEncoder.UseJSONTags(false)
form.DefaultDecoder = form.DefaultDecoder.UseJSONTags(false)
}

func (s *S) TearDownSuite(c *check.C) {
os.Unsetenv("TSURU_TARGET")
os.Unsetenv("TSURU_TOKEN")
}

func (s *S) SetUpTest(c *check.C) {
os.Setenv("TSURU_TARGET", "http://localhost:8080")
os.Setenv("TSURU_TOKEN", "sometoken")
s.defaultLocation = *formatter.LocalTZ
location, err := time.LoadLocation("US/Central")
if err == nil {
formatter.LocalTZ = location
}
config.ResetFileSystem()
}

func (s *S) TearDownTest(c *check.C) {
os.Unsetenv("TSURU_TARGET")
os.Unsetenv("TSURU_TOKEN")
formatter.LocalTZ = &s.defaultLocation
}

Expand Down

0 comments on commit a13be1a

Please sign in to comment.