github.com/xtls/xray-core@v1.8.12-0.20240518155711-3168d27b0bdb/infra/conf/http_test.go (about)

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