mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add new unit tests on engine
This commit is contained in:
committed by
Dan Christian Bogos
parent
fedacded6e
commit
8447bbb084
@@ -23,6 +23,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
@@ -2516,3 +2517,14 @@ func TestCDRSCallInvalidServiceMethod(t *testing.T) {
|
||||
t.Errorf("Expected error %v, got %v", rpcclient.ErrUnsupporteServiceMethod, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewMapEventFromReqForm_ParseForm(t *testing.T) {
|
||||
formData := url.Values{}
|
||||
formData.Add("key", "value")
|
||||
req := httptest.NewRequest("POST", "/", strings.NewReader(formData.Encode()))
|
||||
req.Header.Add("Content-Type", "application/x-www-cgrates-urlencoded")
|
||||
_, err := newMapEventFromReqForm(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,3 +184,17 @@ func TestSuretaxSureTaxProcessCdrPostErr(t *testing.T) {
|
||||
t.Errorf("\nExpected: %q, \nReceived: %q", experr, err)
|
||||
}
|
||||
}
|
||||
func TestFieldAsInterfaceEmptyPath(t *testing.T) {
|
||||
|
||||
tDP := &dynamicDP{}
|
||||
|
||||
val, err := tDP.FieldAsInterface([]string{})
|
||||
|
||||
if err != utils.ErrNotFound {
|
||||
t.Errorf("Expected error utils.ErrNotFound, but got: %v", err)
|
||||
}
|
||||
|
||||
if val != nil {
|
||||
t.Errorf("Expected nil value, but got: %v", val)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user