mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 15:48:44 +05:00
Add test for diam_it_test.go(duplicate items)
This commit is contained in:
committed by
Dan Christian Bogos
parent
2634705904
commit
3f12b8470c
@@ -238,6 +238,22 @@ func TestDiamItDryRun(t *testing.T) {
|
||||
} else if val != eVal {
|
||||
t.Errorf("expecting: %s, received: <%s>", eVal, val)
|
||||
}
|
||||
if avps, err := msg.FindAVPsWithPath([]interface{}{"Multiple-Services-Credit-Control", "Rating-Group"}, dict.UndefinedVendorID); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(avps) != 2 {
|
||||
t.Errorf("Unexpected number of Multiple-Services-Credit-Control.Rating-Group : %d", len(avps))
|
||||
} else {
|
||||
if val, err := diamAVPAsString(avps[0]); err != nil {
|
||||
t.Error(err)
|
||||
} else if val != "65000" {
|
||||
t.Errorf("expecting: 65000, received: <%s>", val)
|
||||
}
|
||||
if val, err := diamAVPAsString(avps[1]); err != nil {
|
||||
t.Error(err)
|
||||
} else if val != "100" {
|
||||
t.Errorf("expecting: 100, received: <%s>", val)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,3 +177,30 @@ func TestMessageSetAVPsWithPath(t *testing.T) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eMessage, m)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessageSetAVPsWithPath2(t *testing.T) {
|
||||
eMessage := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
eMessage.NewAVP("Multiple-Services-Credit-Control", avp.Mbit, 0, &diam.GroupedAVP{
|
||||
AVP: []*diam.AVP{
|
||||
diam.NewAVP(432, avp.Mbit, 0, datatype.Unsigned32(65000)),
|
||||
}})
|
||||
eMessage.NewAVP("Multiple-Services-Credit-Control", avp.Mbit, 0, &diam.GroupedAVP{
|
||||
AVP: []*diam.AVP{
|
||||
diam.NewAVP(432, avp.Mbit, 0, datatype.Unsigned32(100)),
|
||||
}})
|
||||
m := diam.NewMessage(diam.CreditControl, diam.RequestFlag, 4,
|
||||
eMessage.Header.HopByHopID, eMessage.Header.EndToEndID, nil)
|
||||
if err := messageSetAVPsWithPath(m,
|
||||
[]string{"Multiple-Services-Credit-Control", "Rating-Group"}, "65000",
|
||||
true, "UTC"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := messageSetAVPsWithPath(m,
|
||||
[]string{"Multiple-Services-Credit-Control", "Rating-Group"}, "100",
|
||||
true, "UTC"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !reflect.DeepEqual(eMessage, m) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eMessage, m)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
"reply_fields":[
|
||||
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2002"},
|
||||
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
|
||||
"type": "*constant", "value": "65000","new_branch": true},
|
||||
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
|
||||
"type": "*constant", "value": "100","new_branch": true},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user