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 setUpClass(cls): setup_logger(LOGS_PATH, LOGS_LEVEL, LOGS_FORMAT) queries.add_user(EXECUTOR) queries.add_user('user_readonly') 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)
def add_event(user_name, args): participants = [Owner(user_name, AccessLevels.EDIT.value)] if args.participants: participants += args.participants event_id = queries.add_event(user_name, args.title, args.fromdt, args.todt, args.description, args.category, args.priority, args.place, participants, args.reminders) print(event_id)
def test_add_event(self): title = 'event_1' from_datetime = datetime(2018, 6, 10, 11, 7) to_datetime = datetime(2018, 6, 10, 12) description = 'test_event' category = 'category_1' priority = 2 place = 'Some address' queries.add_event(EXECUTOR, title, from_datetime, to_datetime, description, category, priority, place) self.assertTrue( Event.objects.filter(title=title, from_datetime=from_datetime, to_datetime=to_datetime, description=description, category=category, priority=2, place=place, status=Statuses.INPROCESS.value, created_by=EXECUTOR).exists())
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])