diff --git a/apier/v1/triggers.go b/apier/v1/triggers.go
index 3236638a0..ee11bc9f4 100644
--- a/apier/v1/triggers.go
+++ b/apier/v1/triggers.go
@@ -118,8 +118,8 @@ type AttrRemoveAccountActionTriggers struct {
UniqueID string
}
-func (apierSv1 *APIerSv1) RemoveAccountActionTriggers(attr AttrRemoveAccountActionTriggers, reply *string) error {
- if missing := utils.MissingStructFields(&attr, []string{utils.AccountField}); len(missing) != 0 {
+func (apierSv1 *APIerSv1) RemoveAccountActionTriggers(attr *AttrRemoveAccountActionTriggers, reply *string) error {
+ if missing := utils.MissingStructFields(attr, []string{utils.AccountField}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
}
tnt := attr.Tenant
diff --git a/console/account_trigger_remove_test.go b/console/account_trigger_remove_test.go
index 30005f3bc..e2b5b15c0 100644
--- a/console/account_trigger_remove_test.go
+++ b/console/account_trigger_remove_test.go
@@ -18,8 +18,15 @@ along with this program. If not, see
package console
-//willfix
-/*
+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"]
@@ -44,4 +51,3 @@ func TestCmdAccountTriggerRemove(t *testing.T) {
t.Fatal(err)
}
}
-*/
diff --git a/console/session_authorize_event.go b/console/session_authorize_event.go
index 8ddc06160..6fd660523 100644
--- a/console/session_authorize_event.go
+++ b/console/session_authorize_event.go
@@ -68,6 +68,6 @@ func (self *CmdSessionsAuthorize) PostprocessRpcParams() error {
}
func (self *CmdSessionsAuthorize) RpcResult() interface{} {
- var atr *sessions.V1AuthorizeReplyWithDigest
+ var atr sessions.V1AuthorizeReplyWithDigest
return &atr
}
diff --git a/console/session_authorize_event_test.go b/console/session_authorize_event_test.go
new file mode 100644
index 000000000..6333d51e9
--- /dev/null
+++ b/console/session_authorize_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 TestCmdSessionAuthorizeEvent(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["session_authorize_event"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.SessionSv1)).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/session_initiate.go b/console/session_initiate.go
index 2039e9968..66e11cf09 100644
--- a/console/session_initiate.go
+++ b/console/session_initiate.go
@@ -68,7 +68,7 @@ func (self *CmdSessionsInitiate) PostprocessRpcParams() error {
}
func (self *CmdSessionsInitiate) RpcResult() interface{} {
- var atr *sessions.V1InitSessionReply
+ var atr sessions.V1InitReplyWithDigest
return &atr
}
diff --git a/console/session_initiate_test.go b/console/session_initiate_test.go
new file mode 100644
index 000000000..c9714daf2
--- /dev/null
+++ b/console/session_initiate_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 TestCmdSessionInitiate(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["session_initiate"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.SessionSv1)).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/session_process_cdr.go b/console/session_process_cdr.go
index 7463620fc..19ed09fba 100644
--- a/console/session_process_cdr.go
+++ b/console/session_process_cdr.go
@@ -64,6 +64,6 @@ func (self *CmdSessionsProcessCDR) PostprocessRpcParams() error {
}
func (self *CmdSessionsProcessCDR) RpcResult() interface{} {
- var atr *string
+ var atr string
return &atr
}
diff --git a/console/session_process_cdr_test.go b/console/session_process_cdr_test.go
new file mode 100644
index 000000000..6fbb544d8
--- /dev/null
+++ b/console/session_process_cdr_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 TestCmdSessionProcessCDR(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["session_process_cdr"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.SessionSv1)).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/session_process_message.go b/console/session_process_message.go
index 2c97383df..03fc33cd5 100644
--- a/console/session_process_message.go
+++ b/console/session_process_message.go
@@ -68,7 +68,7 @@ func (self *CmdSessionsProcessEvent) PostprocessRpcParams() error {
}
func (self *CmdSessionsProcessEvent) RpcResult() interface{} {
- var atr *sessions.V1ProcessMessageReply
+ var atr sessions.V1ProcessMessageReply
return &atr
}
diff --git a/console/session_process_message_test.go b/console/session_process_message_test.go
new file mode 100644
index 000000000..110e1acb5
--- /dev/null
+++ b/console/session_process_message_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 TestCmdSessionProcessMessage(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["session_process_message"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.SessionSv1)).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/session_terminate.go b/console/session_terminate.go
index 980ec3084..7aa59c976 100644
--- a/console/session_terminate.go
+++ b/console/session_terminate.go
@@ -68,6 +68,6 @@ func (self *CmdSessionsTerminate) PostprocessRpcParams() error {
}
func (self *CmdSessionsTerminate) RpcResult() interface{} {
- var atr *string
+ var atr string
return &atr
}
diff --git a/console/session_terminate_test.go b/console/session_terminate_test.go
new file mode 100644
index 000000000..2014da8be
--- /dev/null
+++ b/console/session_terminate_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 TestCmdSessionTerminate(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["session_terminate"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.SessionSv1)).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/session_update.go b/console/session_update.go
index 9e3a337e1..dc6d214b0 100644
--- a/console/session_update.go
+++ b/console/session_update.go
@@ -68,7 +68,7 @@ func (self *CmdSessionsUpdate) PostprocessRpcParams() error {
}
func (self *CmdSessionsUpdate) RpcResult() interface{} {
- var atr *sessions.V1UpdateSessionReply
+ var atr sessions.V1UpdateSessionReply
return &atr
}
diff --git a/console/session_update_test.go b/console/session_update_test.go
new file mode 100644
index 000000000..f5340d0ed
--- /dev/null
+++ b/console/session_update_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 TestCmdSessionUpdate(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["session_update"]
+ // verify if ApierSv1 object has method on it
+ m, ok := reflect.TypeOf(new(v1.SessionSv1)).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_metrics.go b/console/stats_metrics.go
index 21096847a..2c0a41945 100644
--- a/console/stats_metrics.go
+++ b/console/stats_metrics.go
@@ -63,6 +63,6 @@ func (self *CmdGetStatQueueStringMetrics) PostprocessRpcParams() error {
}
func (self *CmdGetStatQueueStringMetrics) RpcResult() interface{} {
- var atr *map[string]string
+ var atr map[string]string
return &atr
}
diff --git a/console/stats_metrics_test.go b/console/stats_metrics_test.go
new file mode 100644
index 000000000..cdfab6305
--- /dev/null
+++ b/console/stats_metrics_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 TestCmdStatsMetrics(t *testing.T) {
+ // commands map is initiated in init function
+ command := commands["stats_metrics"]
+ // 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)
+ }
+}