@@ -6,6 +6,7 @@ use super::{SharingDialog, SharingDialogAction, SharingDialogMode};
66use crate :: auth:: UserUid ;
77use crate :: cloud_object:: Owner ;
88use crate :: cloud_object:: model:: persistence:: CloudModel ;
9+ use crate :: cloud_object:: model:: view:: CloudViewModel ;
910use crate :: drive:: sharing:: { ShareableObject , SharingAccessLevel } ;
1011use crate :: server:: ids:: { ClientId , ServerId , SyncId } ;
1112use crate :: terminal:: TerminalView ;
@@ -18,6 +19,7 @@ use crate::test_util::terminal::{
1819use crate :: workflows:: workflow:: Workflow ;
1920use crate :: workflows:: { CloudWorkflow , CloudWorkflowModel } ;
2021use crate :: workspaces:: team:: { Team , TeamVisibility } ;
22+ use crate :: workspaces:: user_profiles:: UserProfiles ;
2123use crate :: workspaces:: user_workspaces:: UserWorkspaces ;
2224use crate :: workspaces:: workspace:: {
2325 EnforceableSetting , TeamLinkSharingSettings , TeamSettings , Workspace ,
@@ -342,6 +344,14 @@ fn link_sharing_gates_deny_when_the_dialogs_window_cannot_be_resolved() {
342344 } ) ;
343345}
344346
347+ /// A dialog targeting a Warp Drive object renders its owner and reads its access level, which
348+ /// [`initialize_app_for_terminal_view`] alone does not provide models for.
349+ fn initialize_app_for_drive_object_dialog ( app : & mut App ) {
350+ initialize_app_for_terminal_view ( app) ;
351+ app. add_singleton_model ( CloudViewModel :: mock) ;
352+ app. add_singleton_model ( |_| UserProfiles :: new ( Vec :: new ( ) ) ) ;
353+ }
354+
345355/// Puts a Warp Drive object in the cloud model under a server id, so the sharing dialog can
346356/// target it and `UpdateManager` can find it.
347357fn add_shareable_object ( app : & mut App ) -> ServerId {
@@ -394,7 +404,7 @@ fn set_link_permissions(
394404#[ test]
395405fn set_link_permissions_refuses_to_grant_under_a_forbidding_team ( ) {
396406 App :: test ( ( ) , |mut app| async move {
397- initialize_app_for_terminal_view ( & mut app) ;
407+ initialize_app_for_drive_object_dialog ( & mut app) ;
398408
399409 let ( window_id, _terminal) = add_window_with_id_and_terminal ( & mut app, None ) ;
400410 let forbidden_team = team_with_link_sharing ( 456 , "forbids-sharing" , false ) ;
@@ -429,7 +439,7 @@ fn set_link_permissions_refuses_to_grant_under_a_forbidding_team() {
429439#[ test]
430440fn set_link_permissions_grants_under_a_permitting_team ( ) {
431441 App :: test ( ( ) , |mut app| async move {
432- initialize_app_for_terminal_view ( & mut app) ;
442+ initialize_app_for_drive_object_dialog ( & mut app) ;
433443
434444 let ( window_id, _terminal) = add_window_with_id_and_terminal ( & mut app, None ) ;
435445 let permitted_team = team_with_link_sharing ( 123 , "permits-sharing" , true ) ;
0 commit comments