Esempio n. 1
0
 def __init__(self, root_obj, root_view, root_queue, database_facade,
              host_key_observer):
     self.root = root_obj
     self.root_view = root_view
     self.root_queue = root_queue
     self.database_facade = database_facade
     self.host_key_observer = host_key_observer
     self.tor_proxy_running_observable = observable.Observable(False)
     self.host_key_session_passphrase_observable = observable.Observable()
Esempio n. 2
0
 def test_set(self):
     """Should update current data"""
     val = []
     o = observable.Observable(val)
     target = True
     o.set(target)
     self.assertEqual(o.data, target)
Esempio n. 3
0
 def setUp(self):
     self.tmp_db_path = 'models/db/tests/tmpfacadedb.sqlite'
     self.key_text = 'xxx,yyy,zzz'
     self.alt_key_text = 'aaa,bbb,ccc'
     self.host_key_observer = observable.Observable(self.key_text)
     self.dir_maker_test_dir = 'tests/dbfacadetest/'
     self.dir_maker = dirmaker.DirMaker(self.dir_maker_test_dir)
     self.x = databasefacade.DatabaseFacade(self.host_key_observer, self.dir_maker.get_user_database_dir)
Esempio n. 4
0
 def test_set_calls_run_callbacks(self):
     """Should update current data"""
     val = []
     o = observable.Observable(val)
     mock = MagicMock()
     o.add_callback(mock)
     target = True
     o.set(target)
     self.assertIs(mock.called, True)
Esempio n. 5
0
 def setUp(self):
     self.root = tkinter.Tk()
     self.root_view = MagicMock()
     self.root_queue = MagicMock()
     self.database_facade = MagicMock()
     self.key_text = 'xxx,yyy,zzz'
     self.host_key_observer = observable.Observable(self.key_text)
     self.x = rootparameters.RootParameters(self.root, self.root_view,
                                            self.root_queue,
                                            self.database_facade,
                                            self.host_key_observer)
 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)
Esempio n. 7
0
 def test_add_callback(self):
     """Add callback should update the callback attribute"""
     o = observable.Observable()
     mock = MagicMock()
     o.add_callback(mock)
     self.assertEqual(len(o.callbacks), 2)
Esempio n. 8
0
 def test_unset(self):
     """Should update data to none"""
     val = []
     o = observable.Observable(val)
     o.unset()
     self.assertEqual(o.data, None)
Esempio n. 9
0
 def test_get(self):
     """Get should return current data"""
     val = []
     o = observable.Observable(val)
     result = o.get()
     self.assertEqual(result, val)
Esempio n. 10
0
 def test_callbacks_param(self):
     """Set callbacks param on obj"""
     o = observable.Observable()
     self.assertEqual(len(o.callbacks), 1)
Esempio n. 11
0
 def test_exists(self):
     """Observable class object exists"""
     o = observable.Observable()
     self.assertIsInstance(o, observable.Observable)
Esempio n. 12
0
 def setUp(self):
     self.o = observable.Observable()
Esempio n. 13
0
 def __init__(self, get_user_tor_keys_dir_method):
     self.get_user_tor_keys_dir_method = get_user_tor_keys_dir_method
     self.tor_request_proxy_addr = observable.Observable('None...')
     self.tor_response_proxy_addr = observable.Observable('None...')
     self.tor_message_proxy_addr = observable.Observable('None...')
Esempio n. 14
0
 def __init__(self, que, factory, manager):
     self.status = observable.Observable(False)
     self.queue = que
     self.factory = factory(self.queue)
     self.server = manager(self.factory)
Esempio n. 15
0
 def test_run_callbacks(self):
     o = observable.Observable()
     mock = MagicMock(return_value=True)
     o.add_callback(mock)
     o.run_callbacks()
     self.assertIs(mock.called, True)
Esempio n. 16
0
 def test_delete_callback(self):
     o = observable.Observable()
     mock = MagicMock(return_value=True)
     o.add_callback(mock)
     o.delete_callback(mock)
     self.assertEqual(len(o.callbacks), 1)
Esempio n. 17
0
 def test_data_param(self):
     """Set data param on obj"""
     o = observable.Observable(True)
     self.assertEqual(o.data, True)