dc exclude destination test

This commit is contained in:
Radu Ioan Fericean
2016-04-12 19:48:01 +03:00
parent ea0f6745d0
commit cbaeb92626
3 changed files with 21 additions and 1 deletions

View File

@@ -119,3 +119,21 @@ func TestHandleDeivedChargersMatchDestNatRet(t *testing.T) {
t.Error("Derived charger failed to match dest")
}
}
func TestHandleDeivedChargersMatchDestSpec(t *testing.T) {
dcs := &utils.DerivedChargers{
DestinationIDs: utils.NewStringMap("NAT", "SPEC"),
}
if !DerivedChargersMatchesDest(dcs, "0723045326") {
t.Error("Derived charger failed to match dest")
}
}
func TestHandleDeivedChargersMatchDestNegativeSpec(t *testing.T) {
dcs := &utils.DerivedChargers{
DestinationIDs: utils.NewStringMap("NAT", "!SPEC"),
}
if DerivedChargersMatchesDest(dcs, "0723045326") {
t.Error("Derived charger failed to match dest")
}
}

View File

@@ -47,6 +47,7 @@ func TestHistoryDestinations(t *testing.T) {
{"Id":"PSTN_71","Prefixes":["+4971"]},
{"Id":"PSTN_72","Prefixes":["+4972"]},
{"Id":"RET","Prefixes":["0723","0724"]},
{"Id":"SPEC","Prefixes":["0723045"]},
{"Id":"URG","Prefixes":["112"]}`
if !strings.Contains(buf.String(), expected) {
t.Error("Error in destination history content:", buf.String())

View File

@@ -42,6 +42,7 @@ NAT,0723
NAT,+49
RET,0723
RET,0724
SPEC,0723045
PSTN_71,+4971
PSTN_72,+4972
PSTN_70,+4970
@@ -319,7 +320,7 @@ func init() {
}
func TestLoadDestinations(t *testing.T) {
if len(csvr.destinations) != 12 {
if len(csvr.destinations) != 13 {
t.Error("Failed to load destinations: ", len(csvr.destinations))
}
for _, d := range csvr.destinations {