mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add test for TestMapSubsystemIDsHasKey
This commit is contained in:
committed by
Dan Christian Bogos
parent
763e030f03
commit
0d29845611
@@ -128,7 +128,6 @@ func TestMapSubsystemIDsFromSlice(t *testing.T) {
|
||||
} else if !reflect.DeepEqual(mp, eMp) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eMp, mp)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestMapSubsystemIDsFromSliceWithErr(t *testing.T) {
|
||||
@@ -137,5 +136,30 @@ func TestMapSubsystemIDsFromSliceWithErr(t *testing.T) {
|
||||
if _, err := MapSubsystemIDsFromSlice(sls); err != ErrUnsupportedFormat {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapSubsystemIDsHasKey(t *testing.T) {
|
||||
sls := []string{"*event", "*thresholds:ID1;ID2;ID3", "*attributes", "*stats:ID"}
|
||||
eMp := MapSubsystemIDs{
|
||||
"*event": []string{},
|
||||
"*thresholds": []string{"ID1", "ID2", "ID3"},
|
||||
"*attributes": []string{},
|
||||
"*stats": []string{"ID"},
|
||||
}
|
||||
mp, err := MapSubsystemIDsFromSlice(sls)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(mp, eMp) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eMp, mp)
|
||||
}
|
||||
if has := mp.HasKey("*event"); !has {
|
||||
t.Errorf("Expecting: true, received: %+v", has)
|
||||
}
|
||||
if has := mp.HasKey("*thresholds"); !has {
|
||||
t.Errorf("Expecting: true, received: %+v", has)
|
||||
}
|
||||
if has := mp.HasKey("*resources"); has {
|
||||
t.Errorf("Expecting: false, received: %+v", has)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user