summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-06-24 13:57:50 +0300
committerWolfy-J <[email protected]>2019-06-24 13:57:50 +0300
commitd8ccbb94a5915a1957beb162d3c2ecb668087ef3 (patch)
treea11c5e1b90961b98c22eac9abf4c3cef29688c83
parent5a7569883ca7235f64e94d772e0445f2d522fcab (diff)
updated travis
-rw-r--r--service/headers/config_test.go27
-rw-r--r--service/http/config_test.go2
2 files changed, 28 insertions, 1 deletions
diff --git a/service/headers/config_test.go b/service/headers/config_test.go
new file mode 100644
index 00000000..e6b9b8ff
--- /dev/null
+++ b/service/headers/config_test.go
@@ -0,0 +1,27 @@
+package headers
+
+import (
+ "encoding/json"
+ "github.com/spiral/roadrunner/service"
+ "github.com/stretchr/testify/assert"
+ "testing"
+)
+
+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{`{"request": {"From": "Something"}}`}
+ c := &Config{}
+
+ assert.NoError(t, c.Hydrate(cfg))
+}
+
+func Test_Config_Hydrate_Error2(t *testing.T) {
+ cfg := &mockCfg{`{"dir": "/dir/"`}
+ c := &Config{}
+
+ assert.Error(t, c.Hydrate(cfg))
+}
diff --git a/service/http/config_test.go b/service/http/config_test.go
index 6bb314d8..d8b92247 100644
--- a/service/http/config_test.go
+++ b/service/http/config_test.go
@@ -16,7 +16,7 @@ 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}`}
+ cfg := &mockCfg{`{"address": "localhost:8080"}`}
c := &Config{}
assert.NoError(t, c.Hydrate(cfg))