You've already forked focalboard
							
							
				mirror of
				https://github.com/mattermost/focalboard.git
				synced 2025-10-31 00:17:42 +02:00 
			
		
		
		
	single user token in server tests
This commit is contained in:
		| @@ -20,7 +20,8 @@ func TestGetParentID(t *testing.T) { | ||||
| 	cfg := config.Configuration{} | ||||
| 	store := mockstore.NewMockStore(ctrl) | ||||
| 	auth := auth.New(&cfg, store) | ||||
| 	wsserver := ws.NewServer(auth, true) | ||||
| 	sessionToken := "TESTTOKEN" | ||||
| 	wsserver := ws.NewServer(auth, sessionToken) | ||||
| 	webhook := webhook.NewClient(&cfg) | ||||
| 	app := New(&cfg, store, auth, wsserver, &mocks.FileBackend{}, webhook) | ||||
|  | ||||
|   | ||||
| @@ -63,10 +63,11 @@ type Client struct { | ||||
| 	HttpHeader map[string]string | ||||
| } | ||||
|  | ||||
| func NewClient(url string) *Client { | ||||
| func NewClient(url string, sessionToken string) *Client { | ||||
| 	url = strings.TrimRight(url, "/") | ||||
| 	headers := map[string]string{ | ||||
| 		"X-Requested-With": "XMLHttpRequest", | ||||
| 		"Authorization":    "Bearer " + sessionToken, | ||||
| 	} | ||||
| 	return &Client{url, url + API_URL_SUFFIX, &http.Client{}, headers} | ||||
| } | ||||
|   | ||||
| @@ -27,13 +27,14 @@ func getTestConfig() *config.Configuration { | ||||
| } | ||||
|  | ||||
| func SetupTestHelper() *TestHelper { | ||||
| 	sessionToken := "TESTTOKEN" | ||||
| 	th := &TestHelper{} | ||||
| 	srv, err := server.New(getTestConfig(), true) | ||||
| 	srv, err := server.New(getTestConfig(), sessionToken) | ||||
| 	if err != nil { | ||||
| 		panic(err) | ||||
| 	} | ||||
| 	th.Server = srv | ||||
| 	th.Client = client.NewClient(srv.Config().ServerRoot) | ||||
| 	th.Client = client.NewClient(srv.Config().ServerRoot, sessionToken) | ||||
|  | ||||
| 	return th | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user