mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added *tenant case for FieldAsInterface and tested it as well
This commit is contained in:
committed by
Dan Christian Bogos
parent
18783cec46
commit
cc915d693c
@@ -164,6 +164,8 @@ func (ar *AgentRequest) FieldAsInterface(fldPath []string) (val interface{}, err
|
||||
} else {
|
||||
val = ar.Cfg
|
||||
}
|
||||
case utils.MetaTenant:
|
||||
return ar.Tenant, nil
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -990,6 +990,14 @@ func TestAgReqFieldAsInterface(t *testing.T) {
|
||||
} else if !reflect.DeepEqual(rply, expVal) {
|
||||
t.Errorf("Expected %v , received: %v", utils.ToJSON(expVal), utils.ToJSON(rply))
|
||||
}
|
||||
|
||||
path = []string{utils.MetaTenant}
|
||||
expVal = "cgrates.org"
|
||||
if rply, err := agReq.FieldAsInterface(path); err != nil {
|
||||
t.Error()
|
||||
} else if !reflect.DeepEqual(rply, expVal) {
|
||||
t.Errorf("Expected %v , received: %v", utils.ToJSON(expVal), utils.ToJSON(rply))
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgReqFieldAsInterfaceForOneFldPathCgrReq(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user