示例#1
0
    def setUp(self):
        self.username1 = 'username1'
        self.username2 = 'username2'
        self.username3 = 'username3'
        self.username4 = 'username4'
        self.username5 = 'username5'
        self.username6 = 'username6'
        self.username7 = 'username7'
        self.username8 = 'username8'
        self.username9 = 'username9'
        self.username10 = 'username10'

        self.username11 = 'username11'
        self.username12 = 'username12'

        self.organizer1 = create_organizer(self.username11, 'org1')
        self.organizer2 = create_organizer(self.username12, 'org2')

        self.manager1 = create_manager(self.username1, self.organizer1,
                                       self.organizer1.org)

        self.agent11 = create_agent(self.username2, self.manager1)
        self.agent12 = create_agent(self.username3, self.manager1)
        self.agent13 = create_agent(self.username4, self.manager1)
        self.agent14 = create_agent(self.username8, self.manager1)

        self.manager2 = create_manager(self.username5, self.organizer1,
                                       self.organizer1.org)
        self.agent21 = create_agent(self.username6, self.manager2)
        self.agent22 = create_agent(self.username7, self.manager2)

        self.ntf1 = create_notification(self.agent11, NTD['SOS'],
                                        [self.manager1])
        self.ntf2 = create_notification(self.agent12, NTD['Unreachable'],
                                        [self.manager1])
        self.ntf3 = create_notification(self.agent13, NTD['Deadline crossed'],
                                        [self.agent13, self.manager1])
        self.ntf4 = create_notification(None, NTD['New Task'], [self.agent13])
        self.ntf5 = create_notification(self.agent14, NTD['Task started'],
                                        [self.manager1])

        self.ntf6 = create_notification(self.agent11, NTD['SOS'],
                                        [self.manager1])
        self.ntf7 = create_notification(self.agent12, NTD['Unreachable'],
                                        [self.manager1])
        self.ntf8 = create_notification(self.agent13, NTD['Deadline crossed'],
                                        [self.agent13, self.manager1])
        self.ntf9 = create_notification(None, NTD['New Task'], [self.agent13])
        self.ntf10 = create_notification(self.agent14, NTD['Task started'],
                                         [self.manager1])

        self.ntf11 = create_notification(self.agent11, NTD['SOS'],
                                         [self.manager1])
        self.ntf12 = create_notification(self.agent12, NTD['Unreachable'],
                                         [self.manager1])
        self.ntf13 = create_notification(self.agent13, NTD['Deadline crossed'],
                                         [self.agent13, self.manager1])
        self.ntf14 = create_notification(None, NTD['New Task'], [self.agent13])
        self.ntf15 = create_notification(self.agent14, NTD['Task started'],
                                         [self.manager1])
示例#2
0
文件: tests.py 项目: ash018/FFTracker
    def setUp(self):
        self.username1 = 'username1'
        self.username2 = 'username2'
        self.username3 = 'username3'
        self.username4 = 'username4'
        self.username5 = 'username5'
        self.username6 = 'username6'
        self.username7 = 'username7'
        self.username8 = 'username8'
        self.username9 = 'username9'
        self.username10 = 'username10'

        self.username11 = 'username11'
        self.username12 = 'username12'

        self.organizer1 = create_organizer(self.username11, 'org1')
        self.organizer2 = create_organizer(self.username12, 'org2')

        self.manager1 = create_manager(self.username1, self.organizer1,
                                       self.organizer1.org)

        self.agent11 = create_agent(self.username2, self.manager1)
        self.agent12 = create_agent(self.username3, self.manager1)
        self.agent13 = create_agent(self.username4, self.manager1)
        self.agent14 = create_agent(self.username8, self.manager1)

        self.manager2 = create_manager(self.username5, self.organizer1,
                                       self.organizer1.org)
        self.agent21 = create_agent(self.username6, self.manager2)
        self.agent22 = create_agent(self.username7, self.manager2)
示例#3
0
文件: tests.py 项目: ash018/FFTracker
    def setUp(self):
        self.valid_access_token1 = 'EMAWd6pxUXs2pZAyHQFxVr3i3ZArx5sUdNu0LxzSBV98SVDVXNruFqsHpZCHfe6h5KJVKkzLpduU8r0F4gQGWDhbuUVMjb4lGaMKFBCiQybF7tLvyEdOMmF7uUhhITRQZBGWPBMZBAVBPk09kbTWn7j91yKWY6CJCUZD'
        self.username1 = 'username1'
        self.username2 = 'username2'
        self.username3 = 'username3'
        self.username4 = 'username4'
        self.username5 = 'username5'
        self.username6 = 'username6'
        self.username7 = 'username7'
        self.username8 = 'username8'
        self.username9 = 'username9'
        self.username10 = 'username10'

        self.username11 = 'username11'
        self.username12 = 'username12'

        self.username20 = 'username20'

        self.organizer1 = create_organizer(self.username11, 'org1')
        self.organizer2 = create_organizer(self.username12, 'org2')
示例#4
0
    def setUp(self):
        self.username1 = 'username1'
        self.username2 = 'username2'
        self.username3 = 'username3'
        self.username4 = 'username4'
        self.username5 = 'username5'
        self.username6 = 'username6'
        self.username7 = 'username7'
        self.username8 = 'username8'
        self.username9 = 'username9'
        self.username10 = 'username10'

        self.username11 = 'username11'
        self.username12 = 'username12'

        self.organizer1 = create_organizer(self.username11, 'org1')
        self.organizer2 = create_organizer(self.username12, 'org2')

        self.manager1 = create_manager(self.username1, self.organizer1,
                                       self.organizer1.org)

        self.agent11 = create_agent(self.username2,
                                    self.manager1,
                                    is_present=False)
        self.agent12 = create_agent(self.username3,
                                    self.manager1,
                                    is_present=False)
        self.agent13 = create_agent(self.username4,
                                    self.manager1,
                                    is_present=False)
        self.agent14 = create_agent(self.username8,
                                    self.manager1,
                                    is_present=False)

        self.manager2 = create_manager(self.username5, self.organizer1,
                                       self.organizer1.org)
        self.agent21 = create_agent(self.username6,
                                    self.manager2,
                                    is_present=False)
        self.agent22 = create_agent(self.username7,
                                    self.manager2,
                                    is_present=False)
        self.agent23 = create_agent(self.username9,
                                    self.manager2,
                                    is_present=False)

        date_str = '2019-03-06'

        # Feb 2019: 26/tue, 27/wed, 28/thu. Mar 2019: 1/fri, 2/sat, 3/sun, 4/mon, 5/tue, 6/wed
        date = timezone.datetime.strptime(date_str, '%Y-%m-%d')
        date = utc.localize(date)
        date += timezone.timedelta(hours=9)
        self.date = date

        # Creating attendance current day.................................
        date_6_3_19 = date
        create_attendance(self.agent11, task_hour_p=49.0, date=date_6_3_19)
        create_attendance(self.agent12,
                          work_hour=timezone.timedelta(hours=6),
                          date=date_6_3_19)
        create_attendance(self.agent13, date=date_6_3_19)

        create_attendance(self.agent21, late_arrival=True, date=date_6_3_19)
        create_attendance(self.agent22,
                          work_hour=timezone.timedelta(hours=6),
                          date=date_6_3_19)
        # This week/month for agent11..........................
        date_5_3_19 = date - timezone.timedelta(days=1)

        create_attendance(self.agent11, date=date_5_3_19)
        create_attendance(self.agent12,
                          work_hour=timezone.timedelta(hours=6),
                          date=date_5_3_19)

        create_attendance(self.agent13, date=date_5_3_19)

        create_attendance(self.agent14, date=date_5_3_19)

        date_4_3_19 = date - timezone.timedelta(days=2)

        create_attendance(self.agent11, late_arrival=True, date=date_4_3_19)

        create_attendance(self.agent12, date=date_4_3_19)

        create_attendance(self.agent14, date=date_4_3_19)

        date_3_3_19 = date - timezone.timedelta(days=3)

        create_attendance(self.agent11, task_hour_p=49.0, date=date_3_3_19)

        create_attendance(self.agent12, task_hour_p=49.0, date=date_3_3_19)

        create_attendance(self.agent13, date=date_3_3_19)

        # last week/month for agent11...........

        date_28_2_19 = date - timezone.timedelta(days=6)

        create_attendance(self.agent11, task_hour_p=49.0, date=date_28_2_19)

        create_attendance(self.agent12,
                          work_hour=timezone.timedelta(hours=6),
                          date=date_28_2_19)

        create_attendance(self.agent14, date=date_28_2_19)

        date_27_2_19 = date - timezone.timedelta(days=7)

        create_attendance(self.agent11,
                          work_hour=timezone.timedelta(hours=6),
                          date=date_27_2_19)

        create_attendance(self.agent12, task_hour_p=49.0, date=date_27_2_19)

        create_attendance(self.agent13, date=date_27_2_19)

        date_26_2_19 = date - timezone.timedelta(days=8)

        create_attendance(self.agent11, task_hour_p=49.0, date=date_26_2_19)

        create_attendance(self.agent12, date=date_26_2_19)

        create_attendance(self.agent13,
                          work_hour=timezone.timedelta(hours=6),
                          date=date_26_2_19)

        create_attendance(self.agent14, date=date_26_2_19)

        # Creating tasks this week/month.................................
        create_task_rpt(self.manager1, [self.agent11],
                        deadline=date - timezone.timedelta(days=1),
                        status=TSD['Complete'])
        create_task_rpt(self.manager1, [self.agent11],
                        deadline=date - timezone.timedelta(days=1),
                        status=TSD['Cancelled'])
        create_task_rpt(self.manager1, [self.agent13],
                        deadline=date - timezone.timedelta(days=2),
                        status=TSD['Remaining'],
                        delayed=True)
        create_task_rpt(self.manager1, [self.agent12],
                        deadline=date - timezone.timedelta(days=2),
                        status=TSD['Postponed'])

        create_task_rpt(self.manager1, [self.agent13],
                        deadline=date - timezone.timedelta(days=3),
                        status=TSD['Remaining'],
                        delayed=True)

        create_task_rpt(self.manager1, [self.agent12],
                        deadline=date - timezone.timedelta(days=3),
                        status=TSD['Complete'],
                        delayed=True)

        # last week/month...........

        create_task_rpt(self.manager1, [self.agent11],
                        deadline=date - timezone.timedelta(days=6),
                        status=TSD['Complete'])
        create_task_rpt(self.manager1, [self.agent11],
                        deadline=date - timezone.timedelta(days=6),
                        status=TSD['Cancelled'])
        create_task_rpt(self.manager1, [self.agent13],
                        deadline=date - timezone.timedelta(days=7),
                        status=TSD['Remaining'],
                        delayed=True)
        create_task_rpt(self.manager1, [self.agent12],
                        deadline=date - timezone.timedelta(days=7),
                        status=TSD['Postponed'])

        create_task_rpt(self.manager1, [self.agent13],
                        deadline=date - timezone.timedelta(days=8),
                        status=TSD['Remaining'],
                        delayed=True)

        create_task_rpt(self.manager1, [self.agent12],
                        deadline=date - timezone.timedelta(days=8),
                        status=TSD['Complete'],
                        delayed=True)