Testing engine.FSCdr.firstDefined function

This commit is contained in:
TeoV
2018-01-26 11:55:20 +02:00
committed by DanB
parent 4b8ec8fecf
commit c35ed63469
2 changed files with 14 additions and 0 deletions

View File

@@ -377,6 +377,7 @@ func TestSMAEventUpdateFromEvent(t *testing.T) {
}
*/
//Here
func TestSMAEventAsSMGenericEvent(t *testing.T) {
var ev map[string]interface{}
if err := json.Unmarshal([]byte(stasisStart), &ev); err != nil {

View File

@@ -525,3 +525,16 @@ func TestFsCdrDDazRSRExtraFields(t *testing.T) {
t.Errorf("Unexpected effective_caller_id_number received: %+v", extraFields["effective_caller_id_number"])
}
}
func TestFsCdrFirstDefined(t *testing.T) {
fsCdr, _ := NewFSCdr(body, fsCdrCfg)
value := fsCdr.firstDefined([]string{utils.CGR_SUBJECT, utils.CGR_ACCOUNT, FS_USERNAME}, FsUsername)
if value != "1001" {
t.Errorf("Expecting: 1001, received: %s", value)
}
value = fsCdr.firstDefined([]string{utils.CGR_ACCOUNT, FS_USERNAME}, FsUsername)
if value != "1001" {
t.Errorf("Expecting: 1001, received: %s", value)
}
}