fixed settings test and error typo
This commit is contained in:
parent
5e6d4d2126
commit
fc133d8665
|
@ -633,7 +633,7 @@ func checkUniqueRuleLabel(value any) error {
|
||||||
if conflicts {
|
if conflicts {
|
||||||
return validation.Errors{
|
return validation.Errors{
|
||||||
strconv.Itoa(i): validation.Errors{
|
strconv.Itoa(i): validation.Errors{
|
||||||
"label": validation.NewError("validation_conflcting_rate_limit_rule", "Rate limit rule configuration with label "+rule.Label+" already exists or conflicts with another rule.").
|
"label": validation.NewError("validation_conflicting_rate_limit_rule", "Rate limit rule configuration with label "+rule.Label+" already exists or conflicts with another rule.").
|
||||||
SetParams(map[string]any{"label": rule.Label}),
|
SetParams(map[string]any{"label": rule.Label}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ func TestSettingsMarshalJSON(t *testing.T) {
|
||||||
}
|
}
|
||||||
rawStr := string(raw)
|
rawStr := string(raw)
|
||||||
|
|
||||||
expected := `{"smtp":{"enabled":false,"port":0,"host":"","username":"abc","authMethod":"","tls":false,"localName":""},"backups":{"cron":"","cronMaxKeep":0,"s3":{"enabled":false,"bucket":"","region":"","endpoint":"","accessKey":"","forcePathStyle":false}},"s3":{"enabled":false,"bucket":"","region":"","endpoint":"","accessKey":"","forcePathStyle":false},"meta":{"appName":"test123","appURL":"","senderName":"","senderAddress":"","hideControls":false},"logs":{"maxDays":0,"minLevel":0,"logIP":false,"logAuthId":false},"batch":{"enabled":false,"maxRequests":0,"timeout":0,"maxBodySize":0},"rateLimits":{"rules":[],"enabled":false},"trustedProxy":{"headers":[],"useLeftmostIP":false}}`
|
expected := `{"smtp":{"enabled":false,"port":0,"host":"","username":"abc","authMethod":"","tls":false,"localName":""},"backups":{"cron":"","cronMaxKeep":0,"s3":{"enabled":false,"bucket":"","region":"","endpoint":"","accessKey":"","forcePathStyle":false}},"s3":{"enabled":false,"bucket":"","region":"","endpoint":"","accessKey":"","forcePathStyle":false},"meta":{"appName":"test123","appURL":"","senderName":"","senderAddress":"","hideControls":false},"rateLimits":{"rules":[],"enabled":false},"trustedProxy":{"headers":[],"useLeftmostIP":false},"batch":{"enabled":false,"maxRequests":0,"timeout":0,"maxBodySize":0},"logs":{"maxDays":0,"minLevel":0,"logIP":false,"logAuthId":false}}`
|
||||||
|
|
||||||
if rawStr != expected {
|
if rawStr != expected {
|
||||||
t.Fatalf("Expected\n%v\ngot\n%v", expected, rawStr)
|
t.Fatalf("Expected\n%v\ngot\n%v", expected, rawStr)
|
||||||
|
|
Loading…
Reference in New Issue