summaryrefslogtreecommitdiff
path: root/service/headers
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 /service/headers
parent5a7569883ca7235f64e94d772e0445f2d522fcab (diff)
updated travis
Diffstat (limited to 'service/headers')
-rw-r--r--service/headers/config_test.go27
1 files changed, 27 insertions, 0 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))
+}