mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 20:59:53 +05:00
Added *tenant case and tested it as well
This commit is contained in:
committed by
Dan Christian Bogos
parent
b41d9ae2d6
commit
4d292cdad9
@@ -165,6 +165,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
|
||||
|
||||
@@ -957,6 +957,7 @@ func TestAgReqFieldAsInterface(t *testing.T) {
|
||||
agReq.CGRRequest.Set(&utils.FullPath{Path: utils.ToR, PathSlice: []string{utils.ToR}}, &utils.DataNode{Type: utils.NMSliceType, Slice: []*utils.DataNode{{Type: utils.NMDataType, Value: &utils.DataLeaf{Data: utils.MetaVoice}}}})
|
||||
agReq.CGRRequest.Set(&utils.FullPath{Path: utils.AccountField, PathSlice: []string{utils.AccountField}}, utils.NewLeafNode("1001"))
|
||||
agReq.CGRRequest.Set(&utils.FullPath{Path: utils.Destination, PathSlice: []string{utils.Destination}}, utils.NewLeafNode("1002"))
|
||||
agReq.CGRRequest.Set(&utils.FullPath{Path: utils.Tenant, PathSlice: []string{utils.Tenant}}, utils.NewLeafNode("cgrates.org"))
|
||||
|
||||
path := []string{utils.MetaCgreq, utils.Usage}
|
||||
var expVal interface{}
|
||||
@@ -990,6 +991,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(err)
|
||||
} 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