def test_import_tasks(self): task100 = Task('Task100') task100.label = "added" task100.unique_id = "1" task101 = Task('Task100') task101.label = "updated" task101.deleted = False task101.unique_id = "1" task102 = Task('Task100') task102.deleted = True task102.label = "deleted" task102.unique_id = "1" tasks_list = [task100, task101, task102] sync_results = self.importer.import_tasks(tasks_list) sync_results_list = sync_results.get_list() self.assertTrue(len(sync_results_list) == 3) print(sync_results_list) self.assertTrue(sync_results_list[0] == SyncAction.ADDED) self.assertTrue(sync_results_list[1] == SyncAction.UPDATED) self.assertTrue(sync_results_list[2] == SyncAction.DELETED)
def add(self, text, label, project, date_expression) -> List[Task]: assert type(text) and type(label) and type(project)\ and type(date_expression) is str task_list = list() if self.__date_generator.validate_input(date_expression): for due_date in self.__date_generator.get_due_dates( date_expression): task = Task(text) task.label = label task.project = project task.date_expression = date_expression task.due_date = due_date self.append(task) task_list.append(task) else: raise AttributeError( f"Provided date expression {date_expression} is invalid") return task_list