mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Improving coverage in config
This commit is contained in:
committed by
Dan Christian Bogos
parent
c8b9ae6732
commit
ca47fb72ef
@@ -6305,15 +6305,27 @@ func TestCGRConfigLoadConfigDBCfgError(t *testing.T) {
|
||||
}
|
||||
|
||||
// unfinished
|
||||
// Cant get err of http.NewRequestWithContext
|
||||
// func TestLoadConfigFromHTTPErrorNewReqCtx(t *testing.T) {
|
||||
// cfgCgr := NewDefaultCGRConfig()
|
||||
|
||||
// ctx := context.Background()
|
||||
|
||||
// url := "https://raw.githubusercontent.com/cgrates/cgrates/master/data/conf/samples/multifiles/a.json"
|
||||
// // ctx, cancel := context.WithTimeout(context.Background(), 10*time.Nanosecond)
|
||||
// // cancel()
|
||||
// url := "https://raw.githubusercontent.com/cgrates/cgrates/master/data/conf/samples/tutmongo/cgrates.json"
|
||||
// expected := "parse \"inexistentURL\": invalid URI for request"
|
||||
// if err := loadConfigFromHTTP(ctx, url, cfgCgr.sections, nil); err == nil || err.Error() != expected {
|
||||
// t.Errorf("Expected %+v, received %+v", expected, err)
|
||||
// if err := loadConfigFromHTTP(nil, url, cfgCgr.sections, nil); err == nil || err.Error() != expected {
|
||||
// t.Errorf("Expected %+v, \nreceived %+v", expected, err)
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
func TestGetDftRemoteHostCfg(t *testing.T) {
|
||||
cgrCfg := NewDefaultCGRConfig()
|
||||
|
||||
exp := cgrCfg.rpcConns[utils.MetaLocalHost].Conns[0]
|
||||
|
||||
if rcv := getDftRemHstCfg(); !reflect.DeepEqual(rcv, exp) {
|
||||
t.Errorf("Expected <%+v>,\nReceived <%+v>", exp, rcv)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user