@@ -72,6 +72,7 @@ type SyncReq struct {
7272type  CSAPI  struct  {
7373	UserID       string 
7474	AccessToken  string 
75+ 	DeviceID     string 
7576	BaseURL      string 
7677	Client       * http.Client 
7778	// how long are we willing to wait for MustSyncUntil.... calls 
@@ -298,7 +299,7 @@ func (c *CSAPI) MustSyncUntil(t *testing.T, syncReq SyncReq, checks ...SyncCheck
298299
299300//RegisterUser will register the user with given parameters and 
300301// return user ID & access token, and fail the test on network error 
301- func  (c  * CSAPI ) RegisterUser (t  * testing.T , localpart , password  string ) (userID , accessToken  string ) {
302+ func  (c  * CSAPI ) RegisterUser (t  * testing.T , localpart , password  string ) (userID , accessToken ,  deviceID  string ) {
302303	t .Helper ()
303304	reqBody  :=  map [string ]interface {}{
304305		"auth" : map [string ]string {
@@ -316,12 +317,13 @@ func (c *CSAPI) RegisterUser(t *testing.T, localpart, password string) (userID,
316317
317318	userID  =  gjson .GetBytes (body , "user_id" ).Str 
318319	accessToken  =  gjson .GetBytes (body , "access_token" ).Str 
319- 	return  userID , accessToken 
320+ 	deviceID  =  gjson .GetBytes (body , "device_id" ).Str 
321+ 	return  userID , accessToken , deviceID 
320322}
321323
322324// RegisterSharedSecret registers a new account with a shared secret via HMAC 
323325// See https://github.com/matrix-org/synapse/blob/e550ab17adc8dd3c48daf7fedcd09418a73f524b/synapse/_scripts/register_new_matrix_user.py#L40 
324- func  (c  * CSAPI ) RegisterSharedSecret (t  * testing.T , user , pass  string , isAdmin  bool ) (userID , password  string ) {
326+ func  (c  * CSAPI ) RegisterSharedSecret (t  * testing.T , user , pass  string , isAdmin  bool ) (userID , accessToken ,  deviceID  string ) {
325327	resp  :=  c .DoFunc (t , "GET" , []string {"_synapse" , "admin" , "v1" , "register" })
326328	if  resp .StatusCode  !=  200  {
327329		t .Skipf ("Homeserver image does not support shared secret registration, /_synapse/admin/v1/register returned HTTP %d" , resp .StatusCode )
@@ -354,7 +356,10 @@ func (c *CSAPI) RegisterSharedSecret(t *testing.T, user, pass string, isAdmin bo
354356	}
355357	resp  =  c .MustDoFunc (t , "POST" , []string {"_synapse" , "admin" , "v1" , "register" }, WithJSONBody (t , reqBody ))
356358	body  =  must .ParseJSON (t , resp .Body )
357- 	return  gjson .GetBytes (body , "user_id" ).Str , gjson .GetBytes (body , "access_token" ).Str 
359+ 	userID  =  gjson .GetBytes (body , "user_id" ).Str 
360+ 	accessToken  =  gjson .GetBytes (body , "access_token" ).Str 
361+ 	deviceID  =  gjson .GetBytes (body , "device_id" ).Str 
362+ 	return  userID , accessToken , deviceID 
358363}
359364
360365// GetCapbabilities queries the server's capabilities 
0 commit comments