def setUp(self): self.command = "<ButtonRelease-1>" self.root = self.tkinter_root self.root_view = MagicMock() self.root_queue = queue.Queue() self.database_facade = MagicMock(spec=databasefacade.DatabaseFacade) self.mock_observer = MagicMock() self.root_params = rootparameters.RootParameters( self.root, self.root_view, self.root_queue, self.database_facade, self.mock_observer) mock_view_method = self.root_params.get_messages_frame = MagicMock( return_value=MagicMock()) self.view = mock_view_method.return_value self.gpg_home_dir_observer = observable.Observable() self.gpg_home_dir_observer.set("tests/data/msg_ctrlr_keys") self.x = messagescontroller.MessagesController( self.root_params, self.gpg_home_dir_observer)
def __init__(self, root, root_view, gpg_data_context, database_facade, tor_data_context): super().__init__(root) self.view = root_view self.gpg_datacontext = gpg_data_context self.database_facade = database_facade self.tor_datacontext = tor_data_context self.root_params = rootparameters.RootParameters( self.root, self.view, self.queue, self.database_facade, self.gpg_datacontext.get_host_key_observer()) self.tornet_controller = tornetcontroller.TorNetController( self.root_params, self.tor_datacontext) self.requests_controller = requestscontroller.RequestsController( self.root_params, self.tor_datacontext, self.gpg_datacontext.get_home_dir_observer()) self.gpg_controller = gpgcontroller.GPGController( self.root_params, self.gpg_datacontext) self.console_controller = consolecontroller.ConsoleController( self.root_params, self.gpg_datacontext) self.message_controller = messagescontroller.MessagesController( self.root_params, self.gpg_datacontext.get_home_dir_observer()) self.config_event_bindings() self.config_menubar() # TODO: host key observer is redundant, can just add callback to the host key observable itself self.gpg_datacontext.host_key_observer.add_callback( self.delay_update_all_treeviews) self.controller_mediator = controllermediator.ControllerMediator( self.database_facade, self.gpg_datacontext, self.tor_datacontext, self.requests_controller, self.message_controller, self.console_controller, self.root_params) self.command_client = commandclient.CommandClient( self.controller_mediator)
def test_constructor_calls_update_all_treeviews_method( self, mocked_method): self.x = messagescontroller.MessagesController( self.root_params, self.gpg_home_dir_observer) self.assertTrue(mocked_method.called)
def test_constructor_calls_config_event_bindings(self, mocked_method): self.x = messagescontroller.MessagesController( self.root_params, self.gpg_home_dir_observer) self.assertTrue(mocked_method.called)
def __init__(self): self.gpg_datacontext = gpgdatacontext.GPGDataContext('tests/data/keys') self.database_facade = databasefacade.DatabaseFacade(self.gpg_datacontext.host_key_observer, func) self.requests_controller = requestscontroller.RequestsController(MagicMock(), MagicMock(), MagicMock() ) self.message_controller = messagescontroller.MessagesController(MagicMock(), MagicMock())