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')
Exemplo n.º 2
0
 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])
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
def add_task(user_name, args):
    owners = [Owner(user_name, AccessLevels.EDIT.value)]
    if args.owners:
        owners += args.owners
    task_id = queries.add_task(user_name, args.title, args.description,
                               args.category, args.deadline, args.priority,
                               owners, args.reminders, args.subtasks)
    print(task_id)
Exemplo n.º 5
0
    def test_add_task(self):
        title = 'task_1'
        description = 'test_task'
        category = 'category_1'
        deadline = datetime(2018, 6, 14, 10)
        priority = 1

        queries.add_task(EXECUTOR, title, description, category, deadline,
                         priority)

        self.assertTrue(
            Task.objects.filter(title=title,
                                description=description,
                                category=category,
                                deadline=deadline,
                                priority=1,
                                status=Statuses.INPROCESS.value,
                                created_by=EXECUTOR).exists())
Exemplo n.º 6
0
    def setUpClass(cls):
        setup_logger(LOGS_PATH, LOGS_LEVEL, LOGS_FORMAT)

        queries.add_user(EXECUTOR)
        queries.add_user('user_2')
        owners = [
            Owner(EXECUTOR, AccessLevels.EDIT.value),
            Owner('user_2', AccessLevels.EDIT.value)
        ]

        cls.task_1_id = queries.add_task(EXECUTOR,
                                         'task_1',
                                         'test_task',
                                         'category_1',
                                         datetime(2018, 6, 14, 3),
                                         1,
                                         owners=owners)
        queries.add_task(EXECUTOR,
                         'task_2',
                         'test_task',
                         'category_2',
                         datetime(2018, 6, 14, 10),
                         1,
                         owners=owners)
        queries.add_task(EXECUTOR,
                         'task_3',
                         'test_task',
                         'category_1',
                         datetime(2018, 6, 20, 3),
                         3,
                         owners=owners)
        queries.add_task(EXECUTOR,
                         'task_4',
                         'test_task',
                         'category_2',
                         datetime(2018, 6, 17, 3),
                         1,
                         owners=owners)
        queries.add_task(EXECUTOR,
                         'task_5',
                         'test_task',
                         'category_1',
                         datetime(2018, 6, 24, 3),
                         1,
                         owners=owners)
    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])