Update accounts_it_test.go in general_tests

This commit is contained in:
TeoV
2017-11-24 12:39:44 +02:00
committed by Dan Christian Bogos
parent 4efb4e0f78
commit fef5bef1c9
2 changed files with 37 additions and 2 deletions

View File

@@ -342,7 +342,7 @@ func (self *ApierV1) RemoveAccount(attr utils.AttrRemoveAccount, reply *string)
return err
}
if err = self.DataManager.CacheDataFromDB(utils.AccountActionPlansPrefix, []string{accID}, true); err == nil || err.Error() != utils.ErrNotFound.Error() {
if err = self.DataManager.CacheDataFromDB(utils.AccountActionPlansPrefix, []string{accID}, true); err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
*reply = OK

View File

@@ -53,6 +53,10 @@ var sTestsAcc = []func(t *testing.T){
testV1AccGetAccountAfterLoad,
testV1AccRemAccount,
testV1AccGetAccountAfterDelete,
testV1AccSetAccount,
testV1AccGetAccountAfterSet,
testV1AccRemAccountSet,
testV1AccGetAccountSetAfterDelete,
testV1AccStopEngine,
}
@@ -143,7 +147,6 @@ func testV1AccRemAccount(t *testing.T) {
} else if reply != utils.OK {
t.Error("Unexpected reply returned", reply)
}
}
func testV1AccGetAccountAfterDelete(t *testing.T) {
@@ -153,6 +156,38 @@ func testV1AccGetAccountAfterDelete(t *testing.T) {
}
}
func testV1AccSetAccount(t *testing.T) {
var reply string
if err := accRpc.Call("ApierV2.SetAccount", &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil {
t.Error(err)
} else if reply != utils.OK {
t.Error("Unexpected reply returned", reply)
}
}
func testV1AccGetAccountAfterSet(t *testing.T) {
var reply *engine.Account
if err := accRpc.Call("ApierV2.GetAccount", &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil {
t.Error(err)
}
}
func testV1AccRemAccountSet(t *testing.T) {
var reply string
if err := accRpc.Call("ApierV1.RemoveAccount", &utils.AttrRemoveAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil {
t.Error(err)
} else if reply != utils.OK {
t.Error("Unexpected reply returned", reply)
}
}
func testV1AccGetAccountSetAfterDelete(t *testing.T) {
var reply *engine.Account
if err := accRpc.Call("ApierV2.GetAccount", &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
}
func testV1AccStopEngine(t *testing.T) {
if err := engine.KillEngine(accDelay); err != nil {
t.Error(err)