http_test.go 761 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package conf_test
  2. import (
  3. "github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
  4. "testing"
  5. . "github.com/v2fly/v2ray-core/v4/infra/conf"
  6. "github.com/v2fly/v2ray-core/v4/proxy/http"
  7. )
  8. func TestHTTPServerConfig(t *testing.T) {
  9. creator := func() cfgcommon.Buildable {
  10. return new(HTTPServerConfig)
  11. }
  12. runMultiTestCase(t, []TestCase{
  13. {
  14. Input: `{
  15. "timeout": 10,
  16. "accounts": [
  17. {
  18. "user": "my-username",
  19. "pass": "my-password"
  20. }
  21. ],
  22. "allowTransparent": true,
  23. "userLevel": 1
  24. }`,
  25. Parser: loadJSON(creator),
  26. Output: &http.ServerConfig{
  27. Accounts: map[string]string{
  28. "my-username": "my-password",
  29. },
  30. AllowTransparent: true,
  31. UserLevel: 1,
  32. Timeout: 10,
  33. },
  34. },
  35. })
  36. }