mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 16:48:45 +05:00
Improving coverage at engine
This commit is contained in:
committed by
Dan Christian Bogos
parent
c216fad65c
commit
affaf7a5f7
@@ -1480,6 +1480,9 @@ func TestStatQueueProfileAsInterface(t *testing.T) {
|
||||
}, {
|
||||
MetricID: utils.MetaACD,
|
||||
FilterIDs: []string{"fltr1"},
|
||||
}, {
|
||||
|
||||
Blockers: utils.DynamicBlockers{{Blocker: true}},
|
||||
}},
|
||||
}
|
||||
if _, err := sqp.FieldAsInterface(nil); err != utils.ErrNotFound {
|
||||
@@ -1618,6 +1621,12 @@ func TestStatQueueProfileAsInterface(t *testing.T) {
|
||||
if val, exp := sqp.Metrics[0].String(), utils.ToJSON(sqp.Metrics[0]); exp != val {
|
||||
t.Errorf("Expected %v \n but received \n %v", utils.ToJSON(exp), utils.ToJSON(val))
|
||||
}
|
||||
|
||||
if val, err := sqp.Metrics[2].FieldAsInterface([]string{utils.Blockers}); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if exp := sqp.Metrics[2].Blockers; !reflect.DeepEqual(exp, val) {
|
||||
t.Errorf("Expected %v \n but received \n %v", utils.ToJSON(exp), utils.ToJSON(val))
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatQueueProfileMerge(t *testing.T) {
|
||||
@@ -1788,3 +1797,21 @@ func TestStatQueueWithAPIOptsMarshalJSONNil(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestStatQueueUnmarshalJSONErrUnmarsheling(t *testing.T) {
|
||||
sq := &StatQueue{}
|
||||
expErr := "invalid character 'Ô' looking for beginning of value"
|
||||
if err := sq.UnmarshalJSON([]byte{212}); err == nil || err.Error() != expErr {
|
||||
t.Errorf("Expected error <%v>, Received error <%v>", expErr, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestStatQueueWithAPIOptsUnmarshalJSONErrWithSSQ(t *testing.T) {
|
||||
ssq := &StatQueueWithAPIOpts{}
|
||||
expErr := "invalid character 'Ô' looking for beginning of value"
|
||||
if err := ssq.UnmarshalJSON([]byte{212}); err == nil || err.Error() != expErr {
|
||||
t.Errorf("Expected error <%v>, Received error <%v>", expErr, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user