tests order

This commit is contained in:
Radu Ioan Fericean
2016-02-05 15:42:11 +02:00
parent 65b8e3ed41
commit c4d70d4fea

View File

@@ -1039,41 +1039,6 @@ func TestApierGetAccountActionTriggers(t *testing.T) {
}
}
// Test here RemAccountActionTriggers
func TestApierRemAccountActionTriggers(t *testing.T) {
if !*testLocal {
return
}
// Test first get so we can steal the id which we need to remove
var reply engine.ActionTriggers
req := AttrAcntAction{Tenant: "cgrates.org", Account: "dan2"}
if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil {
t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error())
} else if len(reply) != 1 || reply[0].ActionsId != "LOG_BALANCE" {
for _, atr := range reply {
t.Logf("ATR: %+v", atr)
}
t.Errorf("Unexpected action triggers received %v", reply)
}
var rmReply string
rmReq := AttrRemoveAccountActionTriggers{Tenant: "cgrates.org", Account: "dan2", UniqueID: reply[0].UniqueID}
if err := rater.Call("ApierV1.ResetAccountActionTriggers", rmReq, &rmReply); err != nil {
t.Error("Got error on ApierV1.ResetActionTiming: ", err.Error())
} else if rmReply != OK {
t.Error("Unexpected answer received", rmReply)
}
if err := rater.Call("ApierV1.RemoveAccountActionTriggers", rmReq, &rmReply); err != nil {
t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error())
} else if rmReply != OK {
t.Error("Unexpected answer received", rmReply)
}
if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil {
t.Error("Got error on ApierV1.GetAccountActionTriggers: ", err.Error())
} else if len(reply) != 0 {
t.Errorf("Unexpected action triggers received %+v", reply[0])
}
}
// Test here SetAccountActionTriggers
func TestApierSetAccountActionTriggers(t *testing.T) {
if !*testLocal {
@@ -1109,6 +1074,41 @@ func TestApierSetAccountActionTriggers(t *testing.T) {
}
}
// Test here RemAccountActionTriggers
func TestApierRemAccountActionTriggers(t *testing.T) {
if !*testLocal {
return
}
// Test first get so we can steal the id which we need to remove
var reply engine.ActionTriggers
req := AttrAcntAction{Tenant: "cgrates.org", Account: "dan2"}
if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil {
t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error())
} else if len(reply) != 1 || reply[0].ActionsId != "LOG_BALANCE" {
for _, atr := range reply {
t.Logf("ATR: %+v", atr)
}
t.Errorf("Unexpected action triggers received %v", reply)
}
var rmReply string
rmReq := AttrRemoveAccountActionTriggers{Tenant: "cgrates.org", Account: "dan2", UniqueID: reply[0].UniqueID}
if err := rater.Call("ApierV1.ResetAccountActionTriggers", rmReq, &rmReply); err != nil {
t.Error("Got error on ApierV1.ResetActionTiming: ", err.Error())
} else if rmReply != OK {
t.Error("Unexpected answer received", rmReply)
}
if err := rater.Call("ApierV1.RemoveAccountActionTriggers", rmReq, &rmReply); err != nil {
t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error())
} else if rmReply != OK {
t.Error("Unexpected answer received", rmReply)
}
if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil {
t.Error("Got error on ApierV1.GetAccountActionTriggers: ", err.Error())
} else if len(reply) != 0 {
t.Errorf("Unexpected action triggers received %+v", reply[0])
}
}
// Test here SetAccount
func TestApierSetAccount(t *testing.T) {
if !*testLocal {