mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fix regexp rules to accept aliases
This commit is contained in:
@@ -197,7 +197,7 @@ var FileValidators = map[string]*FileLineRegexValidator{
|
||||
regexp.MustCompile(`(?:\w+\s*,\s*){3}(?:\d+.?\d*){1}$`),
|
||||
"Tag([0-9A-Za-z_]),DestinationRatesTag([0-9A-Za-z_]),TimingProfile([0-9A-Za-z_]),Weight([0-9.])"},
|
||||
utils.RATING_PROFILES_CSV: &FileLineRegexValidator{utils.RATE_PROFILES_NRCOLS,
|
||||
regexp.MustCompile(`(?:\w+\s*,\s*){2}(?:\*out\s*,\s*){1}(?:\*any\s*,\s*|\w+\s*,\s*){1}(?:\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z){1}(?:\w*\s*,?\s*){2}$`),
|
||||
regexp.MustCompile(`(?:\w+\s*,\s*){2}(?:\*out\s*,\s*){1}(?:\*any\s*,\s*|(\w+;?)+\s*,\s*){1}(?:\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z){1}(?:\w*\s*,?\s*){2}$`),
|
||||
"Tenant([0-9A-Za-z_]),TOR([0-9A-Za-z_]),Direction(*out),Subject([0-9A-Za-z_]|*all),RatesFallbackSubject([0-9A-Za-z_]|<empty>),RatesTimingTag([0-9A-Za-z_]),ActivationTime([0-9T:X])"},
|
||||
utils.SHARED_GROUPS_CSV: &FileLineRegexValidator{utils.SHARED_GROUPS_NRCOLS,
|
||||
regexp.MustCompile(``),
|
||||
@@ -212,7 +212,7 @@ var FileValidators = map[string]*FileLineRegexValidator{
|
||||
regexp.MustCompile(`(?:\w+),(?:\*\w+),(?:\*out),(?:\*\w+),(?:\d+\.?\d*),(?:\w+|\*any)?,(?:\w+),(?:\d+\.?\d*)$`),
|
||||
"Tag([0-9A-Za-z_]),BalanceType(*[a-z_]),Direction(*out),ThresholdType(*[a-z_]),ThresholdValue([0-9]+),DestinationTag([0-9A-Za-z_]|*all),ActionsTag([0-9A-Za-z_]),Weight([0-9]+)"},
|
||||
utils.ACCOUNT_ACTIONS_CSV: &FileLineRegexValidator{utils.ACCOUNT_ACTIONS_NRCOLS,
|
||||
regexp.MustCompile(`(?:\w+\s*,\s*){1}(?:\w+\s*,\s*){1}(?:\*out\s*,\s*){1}(?:\w+\s*,?\s*){2}$`),
|
||||
regexp.MustCompile(`(?:\w+\s*),(?:(\w+;?)+\s*),(?:\*out\s*),(?:\w+\s*),(?:\w+\s*)$`),
|
||||
"Tenant([0-9A-Za-z_]),Account([0-9A-Za-z_.]),Direction(*out),ActionTimingsTag([0-9A-Za-z_]),ActionTriggersTag([0-9A-Za-z_])"},
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ DUMMY,INVALID;DATA
|
||||
var ratingProfilesSample = `#Tenant,TOR,Direction,Subject,ActivationTime,RatingPlanTag,FallbackSubject
|
||||
cgrates.org,call,*out,*any,2012-01-01T00:00:00Z,RP_RETAIL,
|
||||
DUMMY,INVALID;DATA
|
||||
cgrates.org,call,*out,subj1;alias1,2012-01-01T00:00:00Z,RP_RETAIL,
|
||||
`
|
||||
|
||||
var actionsSample = `#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight
|
||||
@@ -81,6 +82,7 @@ DUMMY,INVALID;DATA
|
||||
var accountActionsSample = `#Tenant,Account,Direction,ActionTimingsTag,ActionTriggersTag
|
||||
cgrates.org,1001,*out,PREPAID_10,STANDARD_TRIGGERS
|
||||
DUMMY,INVALID;DATA
|
||||
cgrates.org,1002;1006,*out,PACKAGE_10,STANDARD_TRIGGERS
|
||||
`
|
||||
|
||||
func TestTimingsValidator(t *testing.T) {
|
||||
@@ -219,7 +221,7 @@ func TestRatingProfilesValidator(t *testing.T) {
|
||||
if valid {
|
||||
t.Error("Validation passed for invalid line", string(ln))
|
||||
}
|
||||
case 2:
|
||||
case 2, 4:
|
||||
if !valid {
|
||||
t.Error("Validation did not pass for valid line", string(ln))
|
||||
}
|
||||
@@ -243,7 +245,7 @@ func TestActionsValidator(t *testing.T) {
|
||||
if valid {
|
||||
t.Error("Validation passed for invalid line", string(ln))
|
||||
}
|
||||
case 2, 3, 4:
|
||||
case 2, 3, 4, 7:
|
||||
if !valid {
|
||||
t.Error("Validation did not pass for valid line", string(ln))
|
||||
}
|
||||
@@ -315,7 +317,7 @@ func TestAccountActionsValidator(t *testing.T) {
|
||||
if valid {
|
||||
t.Error("Validation passed for invalid line", string(ln))
|
||||
}
|
||||
case 2:
|
||||
case 2, 4:
|
||||
if !valid {
|
||||
t.Error("Validation did not pass for valid line", string(ln))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user