mirror of
				https://github.com/aler9/rtsp-simple-server
				synced 2025-10-31 02:56:29 +08:00 
			
		
		
		
	This commit is contained in:
		| @@ -11,7 +11,6 @@ import ( | ||||
| 	"testing" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/bluenviron/mediamtx/internal/auth" | ||||
| 	"github.com/bluenviron/mediamtx/internal/conf" | ||||
| 	"github.com/bluenviron/mediamtx/internal/logger" | ||||
| 	"github.com/bluenviron/mediamtx/internal/test" | ||||
| @@ -111,40 +110,6 @@ func TestPreflightRequest(t *testing.T) { | ||||
| 	require.Equal(t, byts, []byte{}) | ||||
| } | ||||
|  | ||||
| func TestConfigAuth(t *testing.T) { | ||||
| 	cnf := tempConf(t, "api: yes\n") | ||||
|  | ||||
| 	api := API{ | ||||
| 		Address:     "localhost:9997", | ||||
| 		ReadTimeout: conf.StringDuration(10 * time.Second), | ||||
| 		Conf:        cnf, | ||||
| 		AuthManager: &test.AuthManager{ | ||||
| 			Func: func(req *auth.Request) error { | ||||
| 				require.Equal(t, &auth.Request{ | ||||
| 					User:   "myuser", | ||||
| 					Pass:   "mypass", | ||||
| 					IP:     req.IP, | ||||
| 					Action: "api", | ||||
| 					Query:  "key=val", | ||||
| 				}, req) | ||||
| 				return nil | ||||
| 			}, | ||||
| 		}, | ||||
| 		Parent: &testParent{}, | ||||
| 	} | ||||
| 	err := api.Initialize() | ||||
| 	require.NoError(t, err) | ||||
| 	defer api.Close() | ||||
|  | ||||
| 	tr := &http.Transport{} | ||||
| 	defer tr.CloseIdleConnections() | ||||
| 	hc := &http.Client{Transport: tr} | ||||
|  | ||||
| 	var out map[string]interface{} | ||||
| 	httpRequest(t, hc, http.MethodGet, "http://myuser:mypass@localhost:9997/v3/config/global/get?key=val", nil, &out) | ||||
| 	require.Equal(t, true, out["api"]) | ||||
| } | ||||
|  | ||||
| func TestConfigGlobalGet(t *testing.T) { | ||||
| 	cnf := tempConf(t, "api: yes\n") | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alessandro Ros
					Alessandro Ros