From 8350c6d18cf0951698a72110d7765c9d95f889ba Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 7 Jan 2019 15:32:26 +0200 Subject: [PATCH] Adjusted httpagent integration tests --- agents/httpagent_it_test.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/agents/httpagent_it_test.go b/agents/httpagent_it_test.go index 2e105f401..f7539103a 100644 --- a/agents/httpagent_it_test.go +++ b/agents/httpagent_it_test.go @@ -180,6 +180,24 @@ func testHAitAuthDryRun(t *testing.T) { } func testHAitAuth1001(t *testing.T) { + acnt := "20002" + maxDuration := 60 + + attrSetBalance := utils.AttrSetBalance{ + Tenant: "cgrates.org", + Account: acnt, + BalanceType: utils.VOICE, + BalanceID: utils.StringPointer("TestDynamicDebitBalance"), + Value: utils.Float64Pointer(float64(maxDuration) * float64(time.Second)), + RatingSubject: utils.StringPointer("*zero5ms"), + } + var reply string + if err := haRPC.Call("ApierV2.SetBalance", attrSetBalance, &reply); err != nil { + t.Error(err) + } else if reply != utils.OK { + t.Errorf("Received: %s", reply) + } + httpConst := "http" addr := haCfg.ListenCfg().HTTPListen if isTls { @@ -187,17 +205,12 @@ func testHAitAuth1001(t *testing.T) { httpConst = "https" } - reqUrl := fmt.Sprintf("%s://%s%s?request_type=OutboundAUTH&CallID=123456&Msisdn=1001&Imsi=2343000000000123&Destination=1002&MSRN=0102220233444488999&ProfileID=1&AgentID=176&GlobalMSISDN=497700056129&GlobalIMSI=214180000175129&ICCID=8923418450000089629&MCC=234&MNC=10&calltype=callback", - httpConst, addr, haCfg.HttpAgentCfg()[0].Url) + reqUrl := fmt.Sprintf("%s://%s%s?request_type=OutboundAUTH&CallID=123456&Msisdn=%s&Imsi=2343000000000123&Destination=1002&MSRN=0102220233444488999&ProfileID=1&AgentID=176&GlobalMSISDN=497700056129&GlobalIMSI=214180000175129&ICCID=8923418450000089629&MCC=234&MNC=10&calltype=callback", + httpConst, addr, haCfg.HttpAgentCfg()[0].Url, acnt) rply, err := httpC.Get(reqUrl) if err != nil { t.Error(err) } - // var eXml []byte - maxDuration := 6042 - if t := time.Now(); t.Weekday() == time.Saturday || t.Weekday() == time.Sunday { // Different rating plans for weekend - maxDuration = 10800 - } eXml := []byte(fmt.Sprintf(` 1