Simplify tests with T.TempDir (#929)
This commit is contained in:
1 parent
2a0ff5ac63
commit
7a2915a37d
8 files changed
+24
-70
No files matched your search
@@ -19,16 +19,6 @@ func CreateTestFile(t *testing.T, path string) {
|
||||
file.Close()
|
||||
}
|
||||
|
||||
// CreateTestDirectory creates a temporary folder which will be deleted when cleanup is called.
|
||||
func CreateTestDirectory(t *testing.T) (path string, cleanup func()) {
|
||||
t.Helper()
|
||||
|
||||
path, err := os.MkdirTemp(os.TempDir(), "")
|
||||
checks.NoError(t, err)
|
||||
|
||||
return path, func() { os.RemoveAll(path) }
|
||||
}
|
||||
|
||||
// TokenRoundTripper is a struct that implements the RoundTripper
|
||||
// interface, specifically to handle the authentication token by adding a token
|
||||
// to the request header. We need this because the API requires that each
|
||||
|
||||
Reference in new issue
Block a user