From 28ebd8ec4a6ba28307c1274995452357b0a88109 Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 27 Aug 2018 08:18:22 -0400 Subject: [PATCH] Add in engine/chargers_test.go test for processEvent --- engine/chargers_test.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/engine/chargers_test.go b/engine/chargers_test.go index 21d9af1cf..43b94715c 100755 --- a/engine/chargers_test.go +++ b/engine/chargers_test.go @@ -37,8 +37,8 @@ var ( ActivationInterval: &utils.ActivationInterval{ ActivationTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC), }, - RunID: "*rated", - AttributeIDs: []string{"ATTR_1"}, + RunID: "TestRunID", + AttributeIDs: []string{"*none"}, Weight: 20, }, &ChargerProfile{ @@ -207,3 +207,20 @@ func TestChargerMatchingChargerProfilesForEvent(t *testing.T) { } } + +func TestChargerProcessEvent(t *testing.T) { + rpl := []*ChrgSProcessEventReply{ + &ChrgSProcessEventReply{ + ChargerSProfile: "CPP_1", + CGREvent: chargerEvents[0], + }, + } + rpl[0].CGREvent.Event[utils.RunID] = cPPs[0].RunID + rcv, err := chargerSrv.processEvent(chargerEvents[0]) + if err != nil { + t.Errorf("Error: %+v", err) + } + if !reflect.DeepEqual(rpl[0], rcv[0]) { + t.Errorf("Expecting: %+v, received: %+v ", utils.ToJSON(rpl[0]), utils.ToJSON(rcv[0])) + } +}