Simplify tests with T.TempDir (#929)

This commit is contained in:
Oleksandr Redko
2025-01-31 20:55:41 +02:00
committed by GitHub
parent 2a0ff5ac63
commit 7a2915a37d
8 changed files with 24 additions and 70 deletions

View File

@@ -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