mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Tests in /engine/model_helpers.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
d95b668d77
commit
faa53bc91f
@@ -6191,3 +6191,34 @@ func TestModelHelpersTestAPItoRouteProfileErr(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestModelHelperAPItoFilterError(t *testing.T) {
|
||||
testStruct := &utils.TPFilterProfile{
|
||||
Filters: []*utils.TPFilter{{
|
||||
Type: "test_type",
|
||||
Element: "",
|
||||
Values: []string{"val1"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := APItoFilter(testStruct, "")
|
||||
if err == nil || err.Error() != "emtpy RSRParser in rule: <>" {
|
||||
t.Errorf("\nExpecting <emtpy RSRParser in rule: <>>,\n Received <%+v>", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestModelHelperAPItoFilterError2(t *testing.T) {
|
||||
testStruct := &utils.TPFilterProfile{
|
||||
ActivationInterval: &utils.TPActivationInterval{
|
||||
ActivationTime: "cat",
|
||||
},
|
||||
}
|
||||
|
||||
_, err := APItoFilter(testStruct, "")
|
||||
if err == nil || err.Error() != "Unsupported time format" {
|
||||
t.Errorf("\nExpecting <Unsupported time format>,\n Received <%+v>", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user