mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 08:38:45 +05:00
Updated migrator integration tests for latest changes
This commit is contained in:
committed by
Dan Christian Bogos
parent
c937a2427d
commit
f9f97ce256
@@ -133,7 +133,7 @@ func (fS *FilterS) Pass(tenant string, filterIDs []string,
|
||||
// NewFilterFromInline parses an inline rule into a compiled Filter
|
||||
func NewFilterFromInline(tenant, inlnRule string) (f *Filter, err error) {
|
||||
ruleSplt := strings.Split(inlnRule, utils.InInFieldSep)
|
||||
if len(ruleSplt) != 3 {
|
||||
if len(ruleSplt) < 3 {
|
||||
return nil, fmt.Errorf("inline parse error for string: <%s>", inlnRule)
|
||||
}
|
||||
f = &Filter{
|
||||
@@ -142,7 +142,7 @@ func NewFilterFromInline(tenant, inlnRule string) (f *Filter, err error) {
|
||||
Rules: []*FilterRule{{
|
||||
Type: ruleSplt[0],
|
||||
FieldName: ruleSplt[1],
|
||||
Values: strings.Split(ruleSplt[2], utils.INFIELD_SEP),
|
||||
Values: strings.Split(strings.Join(ruleSplt[2:], utils.InInFieldSep), utils.INFIELD_SEP),
|
||||
}},
|
||||
}
|
||||
if err = f.Compile(); err != nil {
|
||||
|
||||
@@ -568,9 +568,11 @@ func TestInlineFilterPassFiltersForEvent(t *testing.T) {
|
||||
passEvent := map[string]interface{}{
|
||||
"Account": "1007",
|
||||
}
|
||||
if _, err := filterS.Pass("cgrates.org",
|
||||
[]string{"*string:Account:1007:error"}, nil); err == nil {
|
||||
t.Errorf(err.Error())
|
||||
if pass, err := filterS.Pass("cgrates.org",
|
||||
[]string{"*string:Account:1007:error"}, config.NewNavigableMap(failEvent)); err != nil {
|
||||
t.Error(err)
|
||||
} else if pass {
|
||||
t.Errorf("Expecting: %+v, received: %+v", false, pass)
|
||||
}
|
||||
if pass, err := filterS.Pass("cgrates.org",
|
||||
[]string{"*string:Account:1007"}, config.NewNavigableMap(failEvent)); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user