summaryrefslogtreecommitdiff
path: root/service/static
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-07-08 21:57:15 -0700
committerWolfy-J <[email protected]>2018-07-08 21:57:15 -0700
commit528eb2c1b9befaac82a85de9c6d7dea86da0aaac (patch)
tree7f2afc57c7880b4cbf66fd98d857c0d03607a580 /service/static
parentc691f2b3e91c00d29201f06253b845f59e66959d (diff)
more tests
Diffstat (limited to 'service/static')
-rw-r--r--service/static/config_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/service/static/config_test.go b/service/static/config_test.go
index d2099cdf..baa9776f 100644
--- a/service/static/config_test.go
+++ b/service/static/config_test.go
@@ -3,8 +3,29 @@ package static
import (
"github.com/stretchr/testify/assert"
"testing"
+ "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(t *testing.T) {
+ cfg := &mockCfg{`{"dir": "./"}`}
+ c := &Config{}
+
+ assert.NoError(t, c.Hydrate(cfg))
+}
+
+func Test_Config_Hydrate_Error(t *testing.T) {
+ cfg := &mockCfg{`{"dir": "/dir/"}`}
+ c := &Config{}
+
+ assert.Error(t, c.Hydrate(cfg))
+}
+
func TestConfig_Forbids(t *testing.T) {
cfg := Config{Forbid: []string{".php"}}