mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 18:46:24 +05:00
Improving coverage at config
This commit is contained in:
committed by
Dan Christian Bogos
parent
cef7de30d8
commit
0539893157
@@ -1128,21 +1128,22 @@ func TestCGRConfigTpeSCfg(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// unfinished
|
||||
// func TestCGRConfigV1StoreCfgInDB(t *testing.T) {
|
||||
func TestCGRConfigV1StoreCfgInDB(t *testing.T) {
|
||||
|
||||
// cfg := NewDefaultCGRConfig()
|
||||
// cfg.rldCh = make(chan string, 100)
|
||||
// db := make(CgrJsonCfg)
|
||||
// cfg.db = db
|
||||
cfg := NewDefaultCGRConfig()
|
||||
cfg.rldCh = make(chan string, 100)
|
||||
cfg.db = &mockDb{
|
||||
GetSectionF: func(ctx *context.Context, s string, i interface{}) error { return nil },
|
||||
SetSectionF: func(ctx *context.Context, s string, i interface{}) error { return utils.ErrNotImplemented },
|
||||
}
|
||||
|
||||
// args := &SectionWithAPIOpts{
|
||||
// Sections: []string{utils.MetaAll},
|
||||
// }
|
||||
args := &SectionWithAPIOpts{
|
||||
Sections: []string{GeneralJSON},
|
||||
}
|
||||
|
||||
// var reply string
|
||||
var reply string
|
||||
|
||||
// if err := cfg.V1StoreCfgInDB(context.Background(), args, &reply); err == nil || err != nil {
|
||||
// t.Errorf("Expected %v \n but received \n %v", nil, err)
|
||||
// }
|
||||
// }
|
||||
if err := cfg.V1StoreCfgInDB(context.Background(), args, &reply); err == nil || err != utils.ErrNotImplemented {
|
||||
t.Errorf("Expected %v \n but received \n %v", utils.ErrNotImplemented, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6303,3 +6303,17 @@ func TestCGRConfigLoadConfigDBCfgError(t *testing.T) {
|
||||
t.Errorf("Expected error <%v>, Received error <%v>", utils.ErrNotImplemented, err)
|
||||
}
|
||||
}
|
||||
|
||||
// unfinished
|
||||
// func TestLoadConfigFromHTTPErrorNewReqCtx(t *testing.T) {
|
||||
// cfgCgr := NewDefaultCGRConfig()
|
||||
|
||||
// ctx := context.Background()
|
||||
|
||||
// url := "https://raw.githubusercontent.com/cgrates/cgrates/master/data/conf/samples/multifiles/a.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)
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user