File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
apps/meteor/tests/end-to-end/api Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -142,4 +142,37 @@ describe('[OAuth Server]', () => {
142142 } ) ;
143143 } ) ;
144144 } ) ;
145+
146+ describe ( '[oauth credentials]' , ( ) => {
147+ let accessToken : string ;
148+
149+ before ( ( ) => {
150+ accessToken = refreshedAccessToken ;
151+ } ) ;
152+
153+ it ( 'should be able to use oauth credentials to access v1 endpoints (/v1/me)' , async ( ) => {
154+ await request
155+ . get ( api ( 'me' ) )
156+ . auth ( accessToken , { type : 'bearer' } )
157+ . expect ( 'Content-Type' , 'application/json' )
158+ . expect ( 200 )
159+ . expect ( ( res : Response ) => {
160+ expect ( res . body ) . to . have . property ( 'success' , true ) ;
161+ expect ( res . body ) . to . have . property ( '_id' , 'rocketchat.internal.admin.test' ) ;
162+ } ) ;
163+ } ) ;
164+
165+ it ( 'should be able to use oauth credentials to access v1 endpoints (/v1/users.info)' , async ( ) => {
166+ await request
167+ . get ( api ( 'users.info' ) )
168+ . query ( { username : 'rocketchat.internal.admin.test' } )
169+ . auth ( accessToken , { type : 'bearer' } )
170+ . expect ( 'Content-Type' , 'application/json' )
171+ . expect ( 200 )
172+ . expect ( ( res : Response ) => {
173+ expect ( res . body ) . to . have . property ( 'success' , true ) ;
174+ expect ( res . body ) . to . have . nested . property ( 'user._id' , 'rocketchat.internal.admin.test' ) ;
175+ } ) ;
176+ } ) ;
177+ } ) ;
145178} ) ;
You can’t perform that action at this time.
0 commit comments