diff options
Diffstat (limited to 'service/http')
-rw-r--r-- | service/http/config_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/service/http/config_test.go b/service/http/config_test.go index cb804f4a..86622cdf 100644 --- a/service/http/config_test.go +++ b/service/http/config_test.go @@ -6,8 +6,29 @@ import ( "os" "testing" "time" + "github.com/spiral/roadrunner/service" + "encoding/json" ) +type mockCfg struct{ cfg string } + +func (cfg *mockCfg) Get(name string) service.Config { return nil } +func (cfg *mockCfg) Unmarshal(out interface{}) error { return json.Unmarshal([]byte(cfg.cfg), out) } + +func Test_Config_Hydrate_Error1(t *testing.T) { + cfg := &mockCfg{`{"enable": true}`} + c := &Config{} + + assert.Error(t, c.Hydrate(cfg)) +} + +func Test_Config_Hydrate_Error2(t *testing.T) { + cfg := &mockCfg{`{"dir": "/dir/"`} + c := &Config{} + + assert.Error(t, c.Hydrate(cfg)) +} + func Test_Config_Valid(t *testing.T) { cfg := &Config{ Enable: true, |