diff --git a/apier/v1/triggers.go b/apier/v1/triggers.go
index 88da1093d..6a635c45c 100644
--- a/apier/v1/triggers.go
+++ b/apier/v1/triggers.go
@@ -20,6 +20,7 @@ package v1
import (
"errors"
+ "fmt"
"strings"
"time"
@@ -118,7 +119,7 @@ type AttrRemoveAccountActionTriggers struct {
UniqueID string
}
-func (apierSv1 *APIerSv1) RemoveAccountActionTriggers(attr AttrRemoveAccountActionTriggers, reply *string) error {
+func (apierSv1 *APIerSv1) RemoveAccountActionTriggers(attr *AttrRemoveAccountActionTriggers, reply *string) error {
if missing := utils.MissingStructFields(&attr, []string{utils.AccountField}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
}
@@ -163,8 +164,8 @@ type AttrResetAccountActionTriggers struct {
Executed bool
}
-func (apierSv1 *APIerSv1) ResetAccountActionTriggers(attr AttrResetAccountActionTriggers, reply *string) error {
-
+func (apierSv1 *APIerSv1) ResetAccountActionTriggers(attr *AttrResetAccountActionTriggers, reply *string) error {
+ fmt.Println("yay")
if missing := utils.MissingStructFields(&attr, []string{utils.AccountField}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
}
@@ -352,7 +353,7 @@ func (attr *AttrSetActionTrigger) UpdateActionTrigger(at *engine.ActionTrigger,
}
// SetAccountActionTriggers updates or creates if not present the ActionTrigger for an Account
-func (apierSv1 *APIerSv1) SetAccountActionTriggers(attr AttrSetAccountActionTriggers, reply *string) error {
+func (apierSv1 *APIerSv1) SetAccountActionTriggers(attr *AttrSetAccountActionTriggers, reply *string) error {
if missing := utils.MissingStructFields(&attr, []string{utils.AccountField}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
}
diff --git a/console/account_actionplan_get_test.go b/console/account_actionplan_get_test.go
index 68ae4f6e6..814aed328 100644
--- a/console/account_actionplan_get_test.go
+++ b/console/account_actionplan_get_test.go
@@ -41,11 +41,11 @@ func TestCmdGetAccountActionPlan(t *testing.T) {
}
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assing input parameter")
+ t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assing output parameter")
+ t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
diff --git a/console/account_remove_test.go b/console/account_remove_test.go
index 9e868307d..e546ec65d 100644
--- a/console/account_remove_test.go
+++ b/console/account_remove_test.go
@@ -41,11 +41,11 @@ func TestCmdRemoveAccount(t *testing.T) {
}
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assing input parameter")
+ t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assing output parameter")
+ t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
diff --git a/console/account_set_test.go b/console/account_set_test.go
index f97a6a013..9844e67ba 100644
--- a/console/account_set_test.go
+++ b/console/account_set_test.go
@@ -41,11 +41,11 @@ func TestCmdSetAccount(t *testing.T) {
}
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assing input parameter")
+ t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assing output parameter")
+ t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
diff --git a/console/account_trigger_add_test.go b/console/account_trigger_add_test.go
index 08766a3c3..18a8bc68f 100644
--- a/console/account_trigger_add_test.go
+++ b/console/account_trigger_add_test.go
@@ -39,13 +39,14 @@ func TestCmdAccountTriggerAdd(t *testing.T) {
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
t.Fatalf("invalid number of input parameters ")
}
+
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assing input parameter")
+ t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assing output parameter")
+ t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
diff --git a/console/account_trigger_remove_test.go b/console/account_trigger_remove_test.go
new file mode 100644
index 000000000..10bc3804f
--- /dev/null
+++ b/console/account_trigger_remove_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v1 "github.com/cgrates/cgrates/apier/v1"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccountTriggerRemove(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["account_triggers_remove"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/console/account_trigger_reset.go b/console/account_trigger_reset.go
index 8e9ac9d72..61a1d7701 100644
--- a/console/account_trigger_reset.go
+++ b/console/account_trigger_reset.go
@@ -27,7 +27,7 @@ func init() {
c := &CmdAccountResetTriggers{
name: "account_triggers_reset",
rpcMethod: utils.APIerSv1ResetAccountActionTriggers,
- rpcParams: &v1.AttrRemoveAccountActionTriggers{},
+ rpcParams: &v1.AttrResetAccountActionTriggers{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdAccountResetTriggers struct {
name string
rpcMethod string
- rpcParams *v1.AttrRemoveAccountActionTriggers
+ rpcParams *v1.AttrResetAccountActionTriggers
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdAccountResetTriggers) RpcMethod() string {
func (self *CmdAccountResetTriggers) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
- self.rpcParams = &v1.AttrRemoveAccountActionTriggers{}
+ self.rpcParams = &v1.AttrResetAccountActionTriggers{}
}
return self.rpcParams
}
diff --git a/console/account_trigger_reset_test.go b/console/account_trigger_reset_test.go
new file mode 100644
index 000000000..f71b18ca3
--- /dev/null
+++ b/console/account_trigger_reset_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v1 "github.com/cgrates/cgrates/apier/v1"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccountTriggerReset(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["account_triggers_reset"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/console/account_trigger_set_test.go b/console/account_trigger_set_test.go
new file mode 100644
index 000000000..441d2e98f
--- /dev/null
+++ b/console/account_trigger_set_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v1 "github.com/cgrates/cgrates/apier/v1"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccountTriggerSet(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["account_triggers_set"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/console/accounts.go b/console/accounts.go
index ff5bd2a69..33995bd5a 100644
--- a/console/accounts.go
+++ b/console/accounts.go
@@ -61,7 +61,7 @@ func (self *CmdGetAccounts) PostprocessRpcParams() error {
}
func (self *CmdGetAccounts) RpcResult() interface{} {
- a := make([]engine.Account, 0)
+ a := make([]*engine.Account, 0)
return &a
}
diff --git a/console/accounts_profile.go b/console/accounts_profile.go
index 6b96e885a..06660f1b8 100644
--- a/console/accounts_profile.go
+++ b/console/accounts_profile.go
@@ -26,7 +26,7 @@ func init() {
c := &CmdGetAccountsProfile{
name: "accounts_profile",
rpcMethod: utils.APIerSv1GetAccountProfile,
- rpcParams: &utils.TenantID{},
+ rpcParams: &utils.TenantIDWithOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +36,7 @@ func init() {
type CmdGetAccountsProfile struct {
name string
rpcMethod string
- rpcParams *utils.TenantID
+ rpcParams *utils.TenantIDWithOpts
*CommandExecuter
}
@@ -50,7 +50,7 @@ func (self *CmdGetAccountsProfile) RpcMethod() string {
func (self *CmdGetAccountsProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
- self.rpcParams = &utils.TenantID{}
+ self.rpcParams = &utils.TenantIDWithOpts{}
}
return self.rpcParams
}
diff --git a/console/accounts_profile_ids_test.go b/console/accounts_profile_ids_test.go
new file mode 100644
index 000000000..cc7277d36
--- /dev/null
+++ b/console/accounts_profile_ids_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v1 "github.com/cgrates/cgrates/apier/v1"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccountsProfileIDs(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["accounts_profile_ids"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/console/accounts_profile_rem_test.go b/console/accounts_profile_rem_test.go
new file mode 100644
index 000000000..7b2fc420f
--- /dev/null
+++ b/console/accounts_profile_rem_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v1 "github.com/cgrates/cgrates/apier/v1"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccountsProfileRem(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["accounts_profile_remove"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/console/accounts_profile_set_test.go b/console/accounts_profile_set_test.go
new file mode 100644
index 000000000..3390597af
--- /dev/null
+++ b/console/accounts_profile_set_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v1 "github.com/cgrates/cgrates/apier/v1"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccountsProfileSet(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["accounts_profile_set"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/console/accounts_profile_test.go b/console/accounts_profile_test.go
new file mode 100644
index 000000000..e20f5ee30
--- /dev/null
+++ b/console/accounts_profile_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v1 "github.com/cgrates/cgrates/apier/v1"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccountsProfile(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["accounts_profile"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/console/accounts_test.go b/console/accounts_test.go
new file mode 100644
index 000000000..67218c5c1
--- /dev/null
+++ b/console/accounts_test.go
@@ -0,0 +1,54 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ v2 "github.com/cgrates/cgrates/apier/v2"
+
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestCmdAccounts(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["accounts"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v2.APIerSv2)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
+ if !ok {
+ t.Fatal("method not found")
+ }
+ if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
+ t.Fatalf("invalid number of input parameters ")
+ }
+ // verify the type of input parameter
+ if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
+ t.Fatalf("cannot assign input parameter")
+ }
+ // verify the type of output parameter
+ if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
+ t.Fatalf("cannot assign output parameter")
+ }
+ // for coverage purpose
+ if err := command.PostprocessRpcParams(); err != nil {
+ t.Fatal(err)
+ }
+}