def test_add_plan(self): title = 'plan_1' description = 'test_plan' category = 'category_1' queries.add_plan(EXECUTOR, title, description, category) self.assertTrue( Plan.objects.filter(title=title, description=description, category=category, created_by=EXECUTOR).exists())
def setUpClass(cls): setup_logger(LOGS_PATH, LOGS_LEVEL, LOGS_FORMAT) queries.add_user(USER_NAME) owners = [Owner(USER_NAME, AccessLevels.EDIT.value)] queries.add_task(USER_NAME, title='test_task_1', category='test', owners=owners) queries.add_task(USER_NAME, title='test_task_2', category='test', owners=owners) queries.add_plan(USER_NAME, 'unique_plan', owners=owners) queries.add_reminder( USER_NAME, description='test_reminder_1', remind_in=timedelta(days=1), interval=timedelta(hours=1), weekdays=[0, 6], datetimes=[datetime(2018, 6, 7, 11), datetime(2018, 6, 8, 13)]) queries.add_reminder( USER_NAME, description='test_reminder_2', remind_in=timedelta(hours=5), interval=timedelta(hours=4), datetimes=[datetime(2018, 6, 7, 19), datetime(2018, 6, 7, 23, 5)]) queries.add_reminder(USER_NAME, description='test_reminder_3', start_remind_from=datetime(2018, 6, 7, 6), stop_remind_in=datetime(2018, 6, 15), interval=timedelta(hours=1), weekdays=[3, 4, 5], datetimes=[ datetime(2018, 6, 7, 10, 15), datetime(2018, 6, 7, 18, 50), datetime(2018, 6, 9, 10), datetime(2018, 6, 10, 15) ]) queries.add_reminders_to_task( USER_NAME, queries.get_tasks(USER_NAME, 'test_task_1')[0].id, [queries.get_reminders(USER_NAME, 'test_reminder_1')[0].id]) queries.add_reminders_to_task( USER_NAME, queries.get_tasks(USER_NAME, 'test_task_2')[0].id, [queries.get_reminders(USER_NAME, 'test_reminder_2')[0].id])
def setUpClass(cls): setup_logger(LOGS_PATH, LOGS_LEVEL, LOGS_FORMAT) queries.add_user(EXECUTOR) queries.add_user('user_readonly') queries.add_user('user_2') queries.add_user('user_3') cls.task_1_id = queries.add_task(EXECUTOR, 'task_1', 'test_task') cls.task_2_id = queries.add_task(EXECUTOR, 'task_2', 'test_task') cls.task_3_id = queries.add_task(EXECUTOR, 'task_3', 'test_task') cls.task_4_id = queries.add_task(EXECUTOR, 'task_4', 'test_task') cls.task_5_id = queries.add_task(EXECUTOR, 'task_5', 'test_task') cls.event_1_id = queries.add_event(EXECUTOR, 'event_1', description='test_event') cls.event_2_id = queries.add_event(EXECUTOR, 'event_2', description='test_event') cls.plan_id = queries.add_plan(EXECUTOR, 'plan_1', 'test_plan') cls.reminder_1_id = queries.add_reminder( EXECUTOR, 'test_reminder_1', None, datetime(2018, 6, 15, 13, 45), datetime(2018, 7, 1, 11, 10), timedelta(days=3), [ datetime(2018, 6, 18, 18, 30), datetime(2018, 6, 20, 12) ], timedelta(minutes=30), [0, 1] ) cls.reminder_2_id = queries.add_reminder(EXECUTOR, 'test_reminder_2')
def add_plan(user_name, args): owners = [Owner(user_name, AccessLevels.EDIT.value)] if args.owners: owners += args.owners plan_id = queries.add_plan(user_name, args.title, args.description, args.category, args.priority, args.tasks, args.events, args.reminders, owners) print(plan_id)
def setUpClass(cls): setup_logger(LOGS_PATH, LOGS_LEVEL, LOGS_FORMAT) queries.add_user(EXECUTOR) queries.add_user('user_readonly') queries.add_user('user_1') owners = [ Owner(EXECUTOR, AccessLevels.EDIT.value), Owner('user_readonly', AccessLevels.READONLY.value) ] cls.task_id = queries.add_task(EXECUTOR, 'task_1', 'test_task', 'category_1', datetime(2018, 6, 14, 3), 1, owners=owners) cls.event_id = queries.add_event(EXECUTOR, 'event_1', datetime(2018, 6, 20), datetime(2018, 6, 21), 'test_event', 'category_1', 1, 'Minsk', participants=owners) cls.plan_id = queries.add_plan(EXECUTOR, 'plan_1', 'test_plan', 'category_2', owners=owners) cls.reminder_id = queries.add_reminder( EXECUTOR, 'test_reminder', None, datetime(2018, 6, 15, 13, 45), datetime(2018, 7, 1, 11, 10), timedelta(days=3), [datetime(2018, 6, 18, 18, 30), datetime(2018, 6, 20, 12)], timedelta(minutes=30), [0, 1])