mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add test for getting other fields from CostDetails
This commit is contained in:
committed by
Dan Christian Bogos
parent
b6b3af0e13
commit
53d14aa7f8
@@ -813,6 +813,34 @@ func TestCDRAsExportRecord(t *testing.T) {
|
|||||||
t.Errorf("Expecting: <%q>,\n Received: <%q>", expected, expRecord[0])
|
t.Errorf("Expecting: <%q>,\n Received: <%q>", expected, expRecord[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expected = "CustomDestination"
|
||||||
|
prsr = config.NewRSRParsersMustCompile("~*req.CostDetails.RatingFilters:s/DestinationID\"\\s?\\:\\s?\"([^\"]*)\".*/$1/", true, utils.INFIELD_SEP)
|
||||||
|
cfgCdrFld = &config.FCTemplate{
|
||||||
|
Tag: "DestinationID",
|
||||||
|
Type: utils.META_COMPOSED,
|
||||||
|
Path: "*exp.CustomDestinationID",
|
||||||
|
Value: prsr,
|
||||||
|
}
|
||||||
|
if expRecord, err := cdr.AsExportRecord([]*config.FCTemplate{cfgCdrFld}, false, nil, nil); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
} else if expRecord[0] != expected {
|
||||||
|
t.Errorf("Expecting: <%q>,\n Received: <%q>", expected, expRecord[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
expected = "26377"
|
||||||
|
prsr = config.NewRSRParsersMustCompile("~*req.CostDetails.RatingFilters:s/DestinationPrefix\"\\s?\\:\\s?\"([^\"]*)\".*/$1/", true, utils.INFIELD_SEP)
|
||||||
|
cfgCdrFld = &config.FCTemplate{
|
||||||
|
Tag: "DestinationID",
|
||||||
|
Type: utils.META_COMPOSED,
|
||||||
|
Path: "*exp.CustomDestinationID",
|
||||||
|
Value: prsr,
|
||||||
|
}
|
||||||
|
if expRecord, err := cdr.AsExportRecord([]*config.FCTemplate{cfgCdrFld}, false, nil, nil); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
} else if expRecord[0] != expected {
|
||||||
|
t.Errorf("Expecting: <%q>,\n Received: <%q>", expected, expRecord[0])
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCDRAsExportMap(t *testing.T) {
|
func TestCDRAsExportMap(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user