ApierV1.RemAccountActionTriggers using ActionTriggersId

This commit is contained in:
DanB
2015-02-20 16:47:54 +01:00
parent 461b715c3b
commit 9bbc672ba1
2 changed files with 7 additions and 7 deletions

View File

@@ -118,10 +118,10 @@ func (self *ApierV1) GetAccountActionTriggers(attrs AttrAcntAction, reply *engin
}
type AttrRemAcntActionTriggers struct {
Tenant string // Tenant he account belongs to
Account string // Account name
Direction string // Traffic direction
ActionTriggerId string // Id filtering only specific id to remove (can be regexp pattern)
Tenant string // Tenant he account belongs to
Account string // Account name
Direction string // Traffic direction
ActionTriggersId string // Id filtering only specific id to remove (can be regexp pattern)
}
// Returns a list of ActionTriggers on an account
@@ -136,8 +136,8 @@ func (self *ApierV1) RemAccountActionTriggers(attrs AttrRemAcntActionTriggers, r
return 0, err
}
for idx, actr := range ub.ActionTriggers {
match, _ := regexp.MatchString(attrs.ActionTriggerId, actr.Id)
if len(attrs.ActionTriggerId) != 0 && !match {
match, _ := regexp.MatchString(attrs.ActionTriggersId, actr.Id)
if len(attrs.ActionTriggersId) != 0 && !match {
continue
}
if len(ub.ActionTriggers) != 1 { // Remove by index

View File

@@ -1090,7 +1090,7 @@ func TestApierRemAccountActionTriggers(t *testing.T) {
t.Errorf("Unexpected action triggers received %v", reply)
}
var rmReply string
rmReq := AttrRemAcntActionTriggers{Tenant: "cgrates.org", Account: "dan2", Direction: "*out", ActionTriggerId: reply[0].Id}
rmReq := AttrRemAcntActionTriggers{Tenant: "cgrates.org", Account: "dan2", Direction: "*out", ActionTriggersId: reply[0].Id}
if err := rater.Call("ApierV1.RemAccountActionTriggers", rmReq, &rmReply); err != nil {
t.Error("Got error on ApierV1.RemActionTiming: ", err.Error())
} else if rmReply != OK {