1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 18:17:52 -05:00
v2fly/proxy/blackhole/config_json_test.go
2016-09-22 12:01:36 +02:00

32 lines
594 B
Go

// +build json
package blackhole_test
import (
"encoding/json"
"testing"
. "v2ray.com/core/proxy/blackhole"
"v2ray.com/core/testing/assert"
)
func TestHTTPResponseJSON(t *testing.T) {
assert := assert.On(t)
rawJson := `{
"response": {
"type": "http"
}
}`
config := new(Config)
err := json.Unmarshal([]byte(rawJson), config)
assert.Error(err).IsNil()
assert.Int(int(config.Response.Type)).Equals(int(Response_HTTP))
response, err := config.Response.GetInternalResponse()
assert.Error(err).IsNil()
_, ok := response.(*HTTPResponse)
assert.Bool(ok).IsTrue()
}