chore: refactor license validation (#20411)

This commit is contained in:
Marcin Tojek
2025-10-22 16:12:36 +02:00
committed by GitHub
parent 823b14aa34
commit caeca1097b
3 changed files with 65 additions and 3 deletions
@@ -186,6 +186,8 @@ type LicenseOptions struct {
// past.
IssuedAt time.Time
Features license.Features
AllowEmpty bool
}
func (opts *LicenseOptions) WithIssuedAt(now time.Time) *LicenseOptions {
@@ -276,10 +278,10 @@ func GenerateLicense(t *testing.T, options LicenseOptions) string {
issuedAt = time.Now().Add(-time.Minute)
}
if options.AccountType == "" {
if !options.AllowEmpty && options.AccountType == "" {
options.AccountType = license.AccountTypeSalesforce
}
if options.AccountID == "" {
if !options.AllowEmpty && options.AccountID == "" {
options.AccountID = "test-account-id"
}