def test_add_folder(self): file_changes.start_observing() path, include, exclude = h_get_dummy_folder_data() file_changes.add_folder(self.path, include, exclude) time.sleep(1) self.assertEqual(1, len(file_changes.watchers)) self.assertEqual([self.path], gen_json.get_all_synced_folders_paths())
def setUp(self): file_changes_json.init_file(empty=True) self.abs_folder_path = h_create_empty_dummy_folder() self.rel_file_path = "test.txt" self.abs_file_path = os.path.join(self.abs_folder_path, self.rel_file_path) with open(self.abs_file_path, "w"): pass file_changes.start_observing() file_changes.add_folder(self.abs_folder_path)
def test_add_single_ignores(self): file_changes.start_observing() file_changes.add_folder(self.path) rel_path = paths.normalize_path("test.txt") time.sleep(0.3) file_changes.add_single_ignores(self.path, [rel_path]) with open(os.path.join(self.path, rel_path), "w+") as f: f.write("Hello" * 100) folder = file_changes_json.get_folder_entry(self.path) self.assertEqual(0, len(folder["changes"]))
def setUp(self) -> None: time.sleep(0.2) if file_changes.observer.is_alive(): file_changes.stop_observing() # file_changes.observer.unschedule_all() h_clear_init_all_folders() self._server_process = h_start_server_process() file_changes_json.init_file(empty=True) file_changes.start_observing() self.folder1_abs_local_path = client_paths.normalize_path( client_paths.LOCAL_CLIENT_DATA, "folder1") h_create_empty(self.folder1_abs_local_path)
def wrapper(): c_json.init_file() c_file_changes.start_observing() c_file_changes.sync_waiter.waiter.clear() logger_general.info("Start connecting to server") while program_state.program.is_running() and not c_net_start.connect(timeout=60): # connect till connected # TODO: Add server info (IP:PORT) sleep_time = 1 time.sleep(sleep_time) if program_state.program.is_running(): logger_general.info("Start authentication at server: Trying `auto login` fallback `manual login`") authentication.authenticate_only() program_state.is_authenticated_at_server.wait_till_running() if program_state.program.is_running(): c_synchronization.full_synchronize() if program_state.program.is_running(): mainloop()
def setUp(self): file_changes_json.init_file(empty=True) self.abs_folder_path = h_create_empty_dummy_folder() file_changes.start_observing()
def test_remove_folder(self): file_changes.start_observing() file_changes.add_folder(self.path) file_changes.remove_folder_from_watching(self.path) self.assertEqual(0, len(file_changes.watchers))
def test_start_observing(self): file_changes_json.init_file() path, include, exclude = h_get_dummy_folder_data() file_changes.add_folder(self.path, include, exclude) file_changes.start_observing() self.assertEqual(1, len(file_changes.watchers))