mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-05 03:40:01 -06:00
fix sonarcloud offenses
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
)
|
||||
|
||||
func Test_ensureExistsDir(t *testing.T) {
|
||||
func TestEnsureExistsDir(t *testing.T) {
|
||||
var tmpDir = t.TempDir()
|
||||
|
||||
type args struct {
|
||||
@@ -47,7 +47,7 @@ func Test_ensureExistsDir(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_persistKey(t *testing.T) {
|
||||
func TestPersistKey(t *testing.T) {
|
||||
p256 := elliptic.P256()
|
||||
var (
|
||||
tmpDir = t.TempDir()
|
||||
@@ -96,7 +96,7 @@ func Test_persistKey(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_persistCertificate(t *testing.T) {
|
||||
func TestPersistCertificate(t *testing.T) {
|
||||
p256 := elliptic.P256()
|
||||
var (
|
||||
tmpDir = t.TempDir()
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
pkgos "github.com/owncloud/ocis/ocis-pkg/os"
|
||||
)
|
||||
|
||||
func Test_mustUserConfigDir(t *testing.T) {
|
||||
func TestMustUserConfigDir(t *testing.T) {
|
||||
configDir, _ := os.UserConfigDir()
|
||||
type args struct {
|
||||
prefix string
|
||||
@@ -42,23 +42,25 @@ func Test_mustUserConfigDir(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
if tt.resetHome {
|
||||
if err := os.Setenv("HOME", ""); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
unsetHome(t)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil && !tt.panic {
|
||||
t.Errorf("should have panicked!")
|
||||
t.Errorf("should have panicked but didn't")
|
||||
}
|
||||
}()
|
||||
|
||||
if got := pkgos.MustUserConfigDir(tt.args.prefix, tt.args.extension); got != tt.want {
|
||||
t.Errorf("MustUserConfigDir() = %v, want %v", got, tt.want)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func unsetHome(t *testing.T) {
|
||||
if err := os.Setenv("HOME", ""); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user