mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: refactor license validation (#20411)
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user