@@ -118,14 +118,8 @@ def test_api_third_party_drive_get_should_refresh_token(
118118
119119 responses .add (
120120 responses .GET ,
121- "http://drive.test/external_api/v1.0/items/" ,
122- status = status .HTTP_200_OK ,
123- json = {
124- "count" : 0 ,
125- "next" : None ,
126- "previous" : None ,
127- "results" : [],
128- },
121+ "http://drive.test/external_api/v1.0/users/me/" ,
122+ status = status .HTTP_401_UNAUTHORIZED ,
129123 )
130124 client .get (reverse ("drive" ) + "?title=test_document" )
131125 assert mock .call_count == 1
@@ -145,19 +139,16 @@ def test_api_third_party_drive_get_search_by_title(
145139 workspace_id = str (uuid .uuid4 ())
146140 responses .add (
147141 responses .GET ,
148- "http://drive.test/external_api/v1.0/items /" ,
142+ "http://drive.test/external_api/v1.0/users/me /" ,
149143 json = {
150- "count" : 1 ,
151- "next" : None ,
152- "previous" : None ,
153- "results" : [
154- {
155- "id" : workspace_id ,
156- "title" : "My Workspace" ,
157- "main_workspace" : True ,
158- "type" : "workspace" ,
159- }
160- ],
144+ "id" : "123" ,
145+ "email" : "john.doe@test.local" ,
146+ "main_workspace" : {
147+ "id" : workspace_id ,
148+ "type" : "folder" ,
149+ "title" : "My Workspace" ,
150+ "main_workspace" : True ,
151+ },
161152 },
162153 status = status .HTTP_200_OK ,
163154 )
@@ -197,10 +188,10 @@ def test_api_third_party_drive_get_search_by_title(
197188 # Verify the requests were made with correct parameters
198189 assert len (responses .calls ) == 2
199190
200- # First request should be to get workspaces
191+ # First request should be to main workspace
201192 assert (
202193 responses .calls [0 ].request .url
203- == "http://drive.test/external_api/v1.0/items /"
194+ == "http://drive.test/external_api/v1.0/users/me /"
204195 )
205196 assert (
206197 responses .calls [0 ].request .headers ["Authorization" ]
@@ -227,21 +218,8 @@ def test_api_third_party_drive_get_no_main_workspace(
227218 # Mock the workspace listing with no main workspace
228219 responses .add (
229220 responses .GET ,
230- "http://drive.test/external_api/v1.0/items/" ,
231- json = {
232- "count" : 1 ,
233- "next" : None ,
234- "previous" : None ,
235- "results" : [
236- {
237- "id" : str (uuid .uuid4 ()),
238- "title" : "Some Workspace" ,
239- "main_workspace" : False ,
240- "type" : "workspace" ,
241- }
242- ],
243- },
244- status = status .HTTP_200_OK ,
221+ "http://drive.test/external_api/v1.0/users/me/" ,
222+ status = status .HTTP_401_UNAUTHORIZED ,
245223 )
246224
247225 response = client .get (reverse ("drive" ) + "?title=test" )
@@ -262,22 +240,19 @@ def test_api_third_party_drive_get_without_title_filter(
262240
263241 workspace_id = str (uuid .uuid4 ())
264242
265- # Mock the workspace listing response
243+ # Mock the users me response
266244 responses .add (
267245 responses .GET ,
268- "http://drive.test/external_api/v1.0/items /" ,
246+ "http://drive.test/external_api/v1.0/users/me /" ,
269247 json = {
270- "count" : 1 ,
271- "next" : None ,
272- "previous" : None ,
273- "results" : [
274- {
275- "id" : workspace_id ,
276- "title" : "My Workspace" ,
277- "main_workspace" : True ,
278- "type" : "workspace" ,
279- }
280- ],
248+ "id" : "123" ,
249+ "email" : "john.doe@test.local" ,
250+ "main_workspace" : {
251+ "id" : workspace_id ,
252+ "type" : "folder" ,
253+ "title" : "My Workspace" ,
254+ "main_workspace" : True ,
255+ },
281256 },
282257 status = status .HTTP_200_OK ,
283258 )
@@ -453,22 +428,19 @@ def test_api_third_party_drive_post_success(
453428 file_id = str (uuid .uuid4 ())
454429 presigned_url = "http://s3.test/presigned-upload-url"
455430
456- # Mock the workspace listing response
431+ # Mock the users me response
457432 responses .add (
458433 responses .GET ,
459- "http://drive.test/external_api/v1.0/items /" ,
434+ "http://drive.test/external_api/v1.0/users/me /" ,
460435 json = {
461- "count" : 1 ,
462- "next" : None ,
463- "previous" : None ,
464- "results" : [
465- {
466- "id" : workspace_id ,
467- "title" : "My Workspace" ,
468- "main_workspace" : True ,
469- "type" : "workspace" ,
470- }
471- ],
436+ "id" : "123" ,
437+ "email" : "john.doe@test.local" ,
438+ "main_workspace" : {
439+ "id" : workspace_id ,
440+ "type" : "folder" ,
441+ "title" : "My Workspace" ,
442+ "main_workspace" : True ,
443+ },
472444 },
473445 status = status .HTTP_200_OK ,
474446 )
@@ -527,7 +499,7 @@ def test_api_third_party_drive_post_success(
527499 # Verify workspace listing request
528500 assert (
529501 responses .calls [0 ].request .url
530- == "http://drive.test/external_api/v1.0/items /"
502+ == "http://drive.test/external_api/v1.0/users/me /"
531503 )
532504 assert (
533505 responses .calls [0 ].request .headers ["Authorization" ]
@@ -561,24 +533,11 @@ def test_api_third_party_drive_post_no_main_workspace(
561533
562534 blob_id = f"msg_{ message .id } _0"
563535
564- # Mock the workspace listing with no main workspace
536+ # Mock the users me as unauthenticated
565537 responses .add (
566538 responses .GET ,
567- "http://drive.test/external_api/v1.0/items/" ,
568- json = {
569- "count" : 1 ,
570- "next" : None ,
571- "previous" : None ,
572- "results" : [
573- {
574- "id" : str (uuid .uuid4 ()),
575- "title" : "Some Workspace" ,
576- "main_workspace" : False ,
577- "type" : "workspace" ,
578- }
579- ],
580- },
581- status = status .HTTP_200_OK ,
539+ "http://drive.test/external_api/v1.0/users/me/" ,
540+ status = status .HTTP_401_UNAUTHORIZED ,
582541 )
583542
584543 response = client .post (
@@ -653,24 +612,21 @@ def test_api_third_party_drive_post_upload_to_s3_fails(
653612 file_id = str (uuid .uuid4 ())
654613 presigned_url = "http://s3.test/presigned-upload-url"
655614
656- # Mock the workspace listing response
615+ # Mock the users me response
657616 responses .add (
658617 responses .GET ,
659- "http://drive.test/external_api/v1.0/items /" ,
618+ "http://drive.test/external_api/v1.0/users/me /" ,
660619 json = {
661- "count" : 1 ,
662- "next" : None ,
663- "previous" : None ,
664- "results" : [
665- {
666- "id" : workspace_id ,
667- "title" : "My Workspace" ,
668- "main_workspace" : True ,
669- "type" : "workspace" ,
670- }
671- ],
620+ "id" : "123" ,
621+ "email" : "john.doe@test.local" ,
622+ "main_workspace" : {
623+ "id" : workspace_id ,
624+ "type" : "folder" ,
625+ "title" : "My Workspace" ,
626+ "main_workspace" : True ,
627+ },
672628 },
673- status = 200 ,
629+ status = status . HTTP_200_OK ,
674630 )
675631
676632 # Mock the file creation response
0 commit comments