authelia/internal/utils
Eng Zer Jun 59c11581b8
test: use testing tempdir tooling (#4468)
This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: James Elliott <james-d-elliott@users.noreply.github.com>
2022-12-04 20:57:28 +11:00
..
aes.go [FEATURE] Create dedicated health endpoint (#1489) 2020-11-25 10:20:52 +11:00
bools.go feat(authentication): password policy (#2723) 2022-04-03 08:32:57 +10:00
bools_test.go feat(authentication): password policy (#2723) 2022-04-03 08:32:57 +10:00
check.go fix(utils): use lower case in error messages (#2144) 2021-07-04 08:08:24 +10:00
clock.go [CI] Add godot linter (#958) 2020-05-02 15:06:39 +10:00
const.go refactor: few misc issues (#4330) 2022-11-04 22:24:10 +11:00
crypto.go fix(configuration): max tls ver not correctly derived (#4428) 2022-11-24 20:32:57 +11:00
crypto_test.go feat(configuration): mtls clients (#4221) 2022-10-21 19:41:33 +11:00
errs.go feat(configuration): replace viper with koanf (#2053) 2021-08-03 19:55:21 +10:00
exec.go refactor: apply godot recommendations (#2839) 2022-01-31 16:25:15 +11:00
files.go feature(oidc): add support for OpenID Connect 2021-05-05 00:15:36 +02:00
files_test.go feature(oidc): add support for OpenID Connect 2021-05-05 00:15:36 +02:00
hashing.go feat(configuration): replace viper with koanf (#2053) 2021-08-03 19:55:21 +10:00
hashing_test.go test: use testing tempdir tooling (#4468) 2022-12-04 20:57:28 +11:00
io.go fix(notification): text emails not encoded properly (#3854) 2022-08-27 07:39:20 +10:00
strings.go refactor: clean up uri checking functions (#3943) 2022-09-03 11:51:02 +10:00
strings_test.go feat(authentication): file password algorithms (#3848) 2022-10-17 21:51:59 +11:00
time.go refactor(configuration): utilize time duration decode hook (#2938) 2022-03-02 17:40:26 +11:00
time_test.go refactor(configuration): utilize time duration decode hook (#2938) 2022-03-02 17:40:26 +11:00
url.go refactor: clean up uri checking functions (#3943) 2022-09-03 11:51:02 +10:00
url_test.go refactor: clean up uri checking functions (#3943) 2022-09-03 11:51:02 +10:00
version.go build: add container labels and annotations (#4071) 2022-09-26 10:05:59 +10:00
version_test.go build: add container labels and annotations (#4071) 2022-09-26 10:05:59 +10:00