mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
more tests
This commit is contained in:
@@ -22,6 +22,16 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDestinationStoreRestore(t *testing.T) {
|
||||
nationale = &Destination{Id: "nat", Prefixes: []string{"0257", "0256", "0723"}}
|
||||
s := nationale.store()
|
||||
d1 := &Destination{Id: "nat"}
|
||||
d1.restore(s)
|
||||
if d1.store() != s {
|
||||
t.Errorf("Expected %q was %q", s, d1.store())
|
||||
}
|
||||
}
|
||||
|
||||
func TestDestinationKyotoStore(t *testing.T) {
|
||||
getter, _ := NewKyotoStorage("test.kch")
|
||||
defer getter.Close()
|
||||
|
||||
@@ -23,6 +23,27 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTariffPlanStoreRestore(t *testing.T) {
|
||||
b1 := &MinuteBucket{Seconds: 10, Priority: 10, Price: 0.01, DestinationId: "nationale"}
|
||||
b2 := &MinuteBucket{Seconds: 100, Priority: 20, Price: 0.0, DestinationId: "retea"}
|
||||
rcb := &RecivedCallBonus{Credit: 100}
|
||||
vd := &VolumeDiscount{100, 10}
|
||||
seara := &TariffPlan{Id: "seara_voo",
|
||||
SmsCredit: 100,
|
||||
ReceivedCallSecondsLimit: 0,
|
||||
RecivedCallBonus: rcb,
|
||||
MinuteBuckets: []*MinuteBucket{b1, b2},
|
||||
VolumeDiscountThresholds: []*VolumeDiscount{vd}}
|
||||
s := seara.store()
|
||||
tp1 := &TariffPlan{Id: "seara_voo"}
|
||||
tp1.restore(s)
|
||||
if tp1.store() != s {
|
||||
t.Errorf("Expected %q was %q", s, tp1.store())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
func TestTariffPlanKyotoStore(t *testing.T) {
|
||||
getter, _ := NewKyotoStorage("test.kch")
|
||||
defer getter.Close()
|
||||
|
||||
Binary file not shown.
@@ -28,6 +28,19 @@ var (
|
||||
retea = &Destination{Id: "retea", Prefixes: []string{"0723", "0724"}}
|
||||
)
|
||||
|
||||
func TestUserBudgetStoreRestore(t *testing.T) {
|
||||
b1 := &MinuteBucket{Seconds: 10, Priority: 10, Price: 0.01, DestinationId: "nationale"}
|
||||
b2 := &MinuteBucket{Seconds: 100, Priority: 20, Price: 0.0, DestinationId: "retea"}
|
||||
seara := &TariffPlan{Id: "seara", SmsCredit: 100, MinuteBuckets: []*MinuteBucket{b1, b2}}
|
||||
rifsBudget := &UserBudget{Id: "other", MinuteBuckets: []*MinuteBucket{b1, b2}, Credit: 21, tariffPlan: seara, ResetDayOfTheMonth: 10}
|
||||
s := rifsBudget.store()
|
||||
ub1 := &UserBudget{Id: "other"}
|
||||
ub1.restore(s)
|
||||
if ub1.store() != s {
|
||||
t.Errorf("Expected %q was %q", s, ub1.store())
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetSecondsForPrefix(t *testing.T) {
|
||||
b1 := &MinuteBucket{Seconds: 10, Priority: 10, destination: nationale}
|
||||
b2 := &MinuteBucket{Seconds: 100, Priority: 20, destination: retea}
|
||||
|
||||
Reference in New Issue
Block a user