diff --git a/console/resources_allocate.go b/console/resources_allocate.go
index c235db96d..c7263a0d2 100644
--- a/console/resources_allocate.go
+++ b/console/resources_allocate.go
@@ -68,6 +68,6 @@ func (self *CmdResourceAllocate) PostprocessRpcParams() error {
}
func (self *CmdResourceAllocate) RpcResult() interface{} {
- var atr *string
+ var atr string
return &atr
}
diff --git a/console/resources_allocate_test.go b/console/resources_allocate_test.go
new file mode 100644
index 000000000..f084567f6
--- /dev/null
+++ b/console/resources_allocate_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 TestCmdResourcesAllocate(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["resources_allocate"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.ResourceSv1)).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/resources_authorize.go b/console/resources_authorize.go
index d3528f2c1..e6fd85cb8 100644
--- a/console/resources_authorize.go
+++ b/console/resources_authorize.go
@@ -68,6 +68,6 @@ func (self *CmdResourceAuthorize) PostprocessRpcParams() error {
}
func (self *CmdResourceAuthorize) RpcResult() interface{} {
- var atr *string
+ var atr string
return &atr
}
diff --git a/console/resources_authorize_test.go b/console/resources_authorize_test.go
new file mode 100644
index 000000000..1a46281a6
--- /dev/null
+++ b/console/resources_authorize_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 TestCmdResourcesAuthorize(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["resources_authorize"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.ResourceSv1)).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/resources_for_event.go b/console/resources_for_event.go
index 61fdb3511..7e73675bc 100644
--- a/console/resources_for_event.go
+++ b/console/resources_for_event.go
@@ -69,6 +69,6 @@ func (self *CmdGetResourceForEvent) PostprocessRpcParams() error {
}
func (self *CmdGetResourceForEvent) RpcResult() interface{} {
- var atr *engine.Resources
+ var atr engine.Resources
return &atr
}
diff --git a/console/resources_for_event_test.go b/console/resources_for_event_test.go
new file mode 100644
index 000000000..4600fb46a
--- /dev/null
+++ b/console/resources_for_event_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 TestCmdResourcesForEvent(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["resources_for_event"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.ResourceSv1)).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/resources_release.go b/console/resources_release.go
index 085117e92..752d48118 100644
--- a/console/resources_release.go
+++ b/console/resources_release.go
@@ -68,6 +68,6 @@ func (self *CmdResourceRelease) PostprocessRpcParams() error {
}
func (self *CmdResourceRelease) RpcResult() interface{} {
- var atr *string
+ var atr string
return &atr
}
diff --git a/console/resources_release_test.go b/console/resources_release_test.go
new file mode 100644
index 000000000..9a2e638b3
--- /dev/null
+++ b/console/resources_release_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 TestCmdResourcesRelease(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["resources_release"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.ResourceSv1)).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/routes.go b/console/routes.go
index 5b61cdfb3..4c5fc6c0a 100644
--- a/console/routes.go
+++ b/console/routes.go
@@ -68,6 +68,6 @@ func (self *CmdRoutesSort) PostprocessRpcParams() error {
}
func (self *CmdRoutesSort) RpcResult() interface{} {
- var atr *engine.SortedRoutes
+ var atr engine.SortedRoutes
return &atr
}
diff --git a/console/routes_test.go b/console/routes_test.go
new file mode 100644
index 000000000..6e61cdfee
--- /dev/null
+++ b/console/routes_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 TestCmdRoutes(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["routes"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.RouteSv1)).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/stats_for_event.go b/console/stats_for_event.go
index 2f600f6cd..f849cafdb 100644
--- a/console/stats_for_event.go
+++ b/console/stats_for_event.go
@@ -68,6 +68,6 @@ func (self *CmdStatsQueueForEvent) PostprocessRpcParams() error {
}
func (self *CmdStatsQueueForEvent) RpcResult() interface{} {
- var atr *[]string
+ var atr []string
return &atr
}
diff --git a/console/stats_for_event_test.go b/console/stats_for_event_test.go
new file mode 100644
index 000000000..c1f7ed09f
--- /dev/null
+++ b/console/stats_for_event_test.go
@@ -0,0 +1,53 @@
+/*
+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 TestCmdStatsForEvent(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["stats_for_event"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.StatSv1)).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/stats_process_event_test.go b/console/stats_process_event_test.go
new file mode 100644
index 000000000..bcc7f7059
--- /dev/null
+++ b/console/stats_process_event_test.go
@@ -0,0 +1,53 @@
+/*
+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 TestCmdStatsProcessEvent(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["stats_process_event"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.StatSv1)).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/stats_profile_ids_test.go b/console/stats_profile_ids_test.go
new file mode 100644
index 000000000..a961b58b9
--- /dev/null
+++ b/console/stats_profile_ids_test.go
@@ -0,0 +1,53 @@
+/*
+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 TestCmdStatsProfileIDs(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["stats_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/stats_profile_rem_test.go b/console/stats_profile_rem_test.go
new file mode 100644
index 000000000..4f5423375
--- /dev/null
+++ b/console/stats_profile_rem_test.go
@@ -0,0 +1,53 @@
+/*
+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 TestCmdStatsProfileRem(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["stats_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/stats_profile_set_test.go b/console/stats_profile_set_test.go
new file mode 100644
index 000000000..e63867f4b
--- /dev/null
+++ b/console/stats_profile_set_test.go
@@ -0,0 +1,53 @@
+/*
+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 TestCmdStatsProfileSet(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["stats_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/stats_profile_test.go b/console/stats_profile_test.go
new file mode 100644
index 000000000..a299fda48
--- /dev/null
+++ b/console/stats_profile_test.go
@@ -0,0 +1,53 @@
+/*
+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 TestCmdStatsProfile(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["stats_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/thresholds_for_event.go b/console/thresholds_for_event.go
index 8bae0027a..fb20cd583 100755
--- a/console/thresholds_for_event.go
+++ b/console/thresholds_for_event.go
@@ -64,6 +64,6 @@ func (self *CmdThresholdsForEvent) PostprocessRpcParams() error {
}
func (self *CmdThresholdsForEvent) RpcResult() interface{} {
- var s *engine.Thresholds
+ var s engine.Thresholds
return &s
}
diff --git a/console/thresholds_for_event_test.go b/console/thresholds_for_event_test.go
new file mode 100644
index 000000000..561b262f0
--- /dev/null
+++ b/console/thresholds_for_event_test.go
@@ -0,0 +1,53 @@
+/*
+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 TestCmdThresholdsForEvent(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["thresholds_for_event"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.ThresholdSv1)).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/trigger_remove.go b/console/trigger_remove.go
index 18a0f45c7..551a78d23 100644
--- a/console/trigger_remove.go
+++ b/console/trigger_remove.go
@@ -19,7 +19,7 @@ along with this program. If not, see
package console
import (
- "github.com/cgrates/cgrates/apier/v1"
+ v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)