mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-01 16:57:46 -04:00
35 lines
577 B
Go
35 lines
577 B
Go
|
package conf_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"v2ray.com/core/common/serial"
|
||
|
. "v2ray.com/core/infra/conf"
|
||
|
"v2ray.com/core/proxy/blackhole"
|
||
|
)
|
||
|
|
||
|
func TestHTTPResponseJSON(t *testing.T) {
|
||
|
creator := func() Buildable {
|
||
|
return new(BlackholeConfig)
|
||
|
}
|
||
|
|
||
|
runMultiTestCase(t, []TestCase{
|
||
|
{
|
||
|
Input: `{
|
||
|
"response": {
|
||
|
"type": "http"
|
||
|
}
|
||
|
}`,
|
||
|
Parser: loadJSON(creator),
|
||
|
Output: &blackhole.Config{
|
||
|
Response: serial.ToTypedMessage(&blackhole.HTTPResponse{}),
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
Input: `{}`,
|
||
|
Parser: loadJSON(creator),
|
||
|
Output: &blackhole.Config{},
|
||
|
},
|
||
|
})
|
||
|
}
|