update gui
This commit is contained in:
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func setRequiredConfigEnvironment(t *testing.T, scheme string) {
|
||||
@@ -63,3 +64,27 @@ func TestConfigAcceptsExplicitInternalGiteaURL(t *testing.T) {
|
||||
t.Fatalf("GiteaInternalURL = %q, want configured private URL", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigAcceptsDayBasedAuthorizationDuration(t *testing.T) {
|
||||
setRequiredConfigEnvironment(t, "https")
|
||||
t.Setenv("TAPM_DEFAULT_DURATION", "7d")
|
||||
cfg, err := LoadConfig()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.DefaultDuration != 7*24*time.Hour {
|
||||
t.Fatalf("DefaultDuration = %s, want 7 days", cfg.DefaultDuration)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigKeepsLegacyHourDurationCompatibility(t *testing.T) {
|
||||
setRequiredConfigEnvironment(t, "https")
|
||||
t.Setenv("TAPM_DEFAULT_DURATION", "3h")
|
||||
cfg, err := LoadConfig()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.DefaultDuration != 3*time.Hour {
|
||||
t.Fatalf("DefaultDuration = %s, want 3 hours", cfg.DefaultDuration)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user