test for DigiDaz regression

This commit is contained in:
Radu Ioan Fericean
2014-04-04 16:51:02 +03:00
parent 517bf7964b
commit 71f296d656
2 changed files with 29 additions and 7 deletions

View File

@@ -575,7 +575,7 @@ func TestMaxDebitZeroDefinedRate(t *testing.T) {
cd1 := &CallDescriptor{
Direction: "*out",
TOR: "call",
Tenant: "cgrates.directvoip.co.uk",
Tenant: "cgrates.org",
Subject: "12345",
Account: "12345",
Destination: "447956",
@@ -603,7 +603,7 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
cd1 := &CallDescriptor{
Direction: "*out",
TOR: "call",
Tenant: "cgrates.directvoip.co.uk",
Tenant: "cgrates.org",
Subject: "12345",
Account: "12345",
Destination: "447956",
@@ -613,7 +613,7 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
CallDuration: 0}
cc, err := cd1.MaxDebit()
if err != nil {
t.Error("Error maxdebiting: ", err)
t.Fatal("Error maxdebiting: ", err)
}
if cc.GetDuration() != 40*time.Second {
t.Error("Error obtaining max debit duration: ", cc.GetDuration())
@@ -623,7 +623,29 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
}
}
/*********************************** BENCHMARKS ***************************************/
func TestMaxDebitConsumesMinutes(t *testing.T) {
ap, _ := accountingStorage.GetActionTimings("TOPUP10_AT")
for _, at := range ap {
at.Execute()
}
cd1 := &CallDescriptor{
Direction: "*out",
TOR: "call",
Tenant: "cgrates.org",
Subject: "12345",
Account: "12345",
Destination: "447956",
TimeStart: time.Date(2014, 3, 4, 6, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2014, 3, 4, 6, 0, 5, 0, time.UTC),
LoopIndex: 0,
CallDuration: 0}
cd1.MaxDebit()
if cd1.account.BalanceMap[MINUTES+OUTBOUND][0].Value != 20 {
t.Error("Error using minutes: ", cd1.account.BalanceMap[MINUTES+OUTBOUND][0].Value)
}
}
/*************** BENCHMARKS ********************/
func BenchmarkStorageGetting(b *testing.B) {
b.StopTimer()
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)

View File

@@ -118,8 +118,8 @@ vdf,0,*out,fallback1,2013-11-18T13:45:00Z,G,fallback2
vdf,0,*out,fallback1,2013-11-18T13:46:00Z,G,fallback2
vdf,0,*out,fallback1,2013-11-18T13:47:00Z,G,fallback2
vdf,0,*out,fallback2,2013-11-18T13:45:00Z,R,rif
cgrates.directvoip.co.uk,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.directvoip.co.uk,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
cgrates.org,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.org,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
`
sharedGroups = `
SG1,*any,*lowest,
@@ -157,7 +157,7 @@ STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,FS_USERS,LOG_WARNING,10
`
accountActions = `
vdf,minitsboy;a1;a2,*out,MORE_MINUTES,STANDARD_TRIGGER
cgrates.directvoip.co.uk,12345,*out,TOPUP10_AT,STANDARD_TRIGGERS
cgrates.org,12345,*out,TOPUP10_AT,STANDARD_TRIGGERS
vdf,empty0,*out,TOPUP_SHARED0_AT,
vdf,empty10,*out,TOPUP_SHARED10_AT,
vdf,emptyX,*out,TOPUP_EMPTY_AT,