summaryrefslogtreecommitdiff
path: root/tests/plugins/static/config_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-04-25 20:18:35 +0300
committerValery Piashchynski <[email protected]>2021-04-25 20:18:35 +0300
commitf6359114607f9daa41aa90d452ebdc970615c3ab (patch)
treed1bc215440949d6615b2c645396e0146843745fa /tests/plugins/static/config_test.go
parent92d089e0ecedaa1ccdf9e2700b9cb2b61f307b1d (diff)
- Initial commit of the updated static plugin
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/static/config_test.go')
-rw-r--r--tests/plugins/static/config_test.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/tests/plugins/static/config_test.go b/tests/plugins/static/config_test.go
deleted file mode 100644
index d73fd845..00000000
--- a/tests/plugins/static/config_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package static
-
-import (
- "testing"
-
- "github.com/spiral/roadrunner/v2/plugins/static"
- "github.com/stretchr/testify/assert"
-)
-
-func TestConfig_Forbids(t *testing.T) {
- cfg := static.Config{Static: &struct {
- Dir string
- Forbid []string
- Always []string
- Request map[string]string
- Response map[string]string
- }{Dir: "", Forbid: []string{".php"}, Always: nil, Request: nil, Response: nil}}
-
- assert.True(t, cfg.AlwaysForbid("index.php"))
- assert.True(t, cfg.AlwaysForbid("index.PHP"))
- assert.True(t, cfg.AlwaysForbid("phpadmin/index.bak.php"))
- assert.False(t, cfg.AlwaysForbid("index.html"))
-}
-
-func TestConfig_Valid(t *testing.T) {
- assert.NoError(t, (&static.Config{Static: &struct {
- Dir string
- Forbid []string
- Always []string
- Request map[string]string
- Response map[string]string
- }{Dir: "./"}}).Valid())
-
- assert.Error(t, (&static.Config{Static: &struct {
- Dir string
- Forbid []string
- Always []string
- Request map[string]string
- Response map[string]string
- }{Dir: "./http.go"}}).Valid())
-
- assert.Error(t, (&static.Config{Static: &struct {
- Dir string
- Forbid []string
- Always []string
- Request map[string]string
- Response map[string]string
- }{Dir: "./dir/"}}).Valid())
-}