mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
added estra fields for user profile loading
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMapStruct(t *testing.T) {
|
||||
func TestStructMapStruct(t *testing.T) {
|
||||
type TestStruct struct {
|
||||
Name string
|
||||
Surname string
|
||||
@@ -61,3 +61,29 @@ func TestMapStructAddStructs(t *testing.T) {
|
||||
t.Errorf("Expected: %+v got: %+v", ts, nts)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStructExtraFields(t *testing.T) {
|
||||
ts := struct {
|
||||
Name string
|
||||
Surname string
|
||||
Address string
|
||||
ExtraFields map[string]string
|
||||
}{
|
||||
Name: "1",
|
||||
Surname: "2",
|
||||
Address: "3",
|
||||
ExtraFields: map[string]string{
|
||||
"k1": "v1",
|
||||
"k2": "v2",
|
||||
"k3": "v3",
|
||||
},
|
||||
}
|
||||
efMap, err := GetMapExtraFields(ts, "ExtraFields")
|
||||
if err != nil {
|
||||
t.Error("Error getting extra fields: ", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(efMap, ts.ExtraFields) {
|
||||
t.Errorf("expected: %v got: %v", ts.ExtraFields, efMap)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user