Ejemplo n.º 1
0
 def setUp(self):
     super(PayrollTest, self).setUp()
     self.user = factories.User()
     self.user2 = factories.User()
     self.superuser = factories.Superuser()
     self.devl_activity = factories.Activity(billable=True)
     self.activity = factories.Activity()
     self.sick = factories.Project(name='sick')
     self.vacation = factories.Project(name='vacation')
     settings.EMS_PAID_LEAVE_PROJECTS = {
         'sick': self.sick.pk,
         'vacation': self.vacation.pk
     }
     self.next = utils.add_timezone(datetime.datetime(2011, 6, 1))
     self.overtime_before = utils.add_timezone(
         datetime.datetime(2011, 4, 29))
     self.first = utils.add_timezone(datetime.datetime(2011, 5, 1))
     self.first_week = utils.add_timezone(datetime.datetime(2011, 5, 2))
     self.middle = utils.add_timezone(datetime.datetime(2011, 5, 18))
     self.last_billable = utils.add_timezone(datetime.datetime(2011, 5, 28))
     self.last = utils.add_timezone(datetime.datetime(2011, 5, 31))
     self.dates = [
         self.overtime_before, self.first, self.first_week, self.middle,
         self.last, self.last_billable, self.next
     ]
     self.url = reverse('report_payroll_summary')
     self.args = {
         'year': self.first.year,
         'month': self.first.month,
     }
Ejemplo n.º 2
0
 def setUp(self):
     super(ReportsTestBase, self).setUp()
     self.user = factories.User()
     self.user2 = factories.User()
     self.superuser = factories.Superuser()
     self.devl_activity = factories.Activity(billable=True)
     self.activity = factories.Activity()
     self.sick = factories.Project()
     self.vacation = factories.Project()
     settings.EMS_PAID_LEAVE_PROJECTS = {
         'sick': self.sick.pk,
         'vacation': self.vacation.pk,
     }
     self.leave = [self.sick.pk, self.vacation.pk]
     self.p1 = factories.BillableProject(name='1')
     self.p2 = factories.NonbillableProject(name='2')
     self.p4 = factories.BillableProject(name='4')
     self.p3 = factories.NonbillableProject(name='1')
     self.p5 = factories.BillableProject(name='3')
     self.default_projects = [self.p1, self.p2, self.p3, self.p4, self.p5]
     self.default_dates = [
         utils.add_timezone(datetime.datetime(2011, 1, 3)),
         utils.add_timezone(datetime.datetime(2011, 1, 4)),
         utils.add_timezone(datetime.datetime(2011, 1, 10)),
         utils.add_timezone(datetime.datetime(2011, 1, 16)),
         utils.add_timezone(datetime.datetime(2011, 1, 17)),
         utils.add_timezone(datetime.datetime(2011, 1, 18)),
     ]
Ejemplo n.º 3
0
 def setUp(self):
     super(TestProjectTimesheet, self).setUp()
     self.user = factories.User()
     self.user2 = factories.User()
     self.superuser = factories.Superuser()
     self.p1 = factories.BillableProject(name='1')
     self.p2 = factories.NonbillableProject(name='2')
     self.p4 = factories.BillableProject(name='4')
     self.p3 = factories.NonbillableProject(name='1')
     self.url_args = (self.p1.pk, )
     self.devl_activity = factories.Activity(billable=True)
     self.activity = factories.Activity()
Ejemplo n.º 4
0
 def setUp(self):
     super(TestCreateProject, self).setUp()
     self.user = factories.User(permissions=self.permissions)
     self.login_user(self.user)
     self.post_data = {
         'name': 'Project',
         'business_1': factories.Business().pk,
         'point_person': factories.Superuser().pk,
         'activity_group': factories.ActivityGroup().pk,
         'type': factories.TypeAttribute().pk,
         'status': factories.StatusAttribute().pk,
         'description': 'a project...',
     }
Ejemplo n.º 5
0
    def setUp(self):
        super(ListOutstandingInvoicesViewTestCase, self).setUp()
        self.user = factories.Superuser()
        self.login_user(self.user)

        start = utils.add_timezone(datetime.datetime(2011, 1, 1, 8))
        end = utils.add_timezone(datetime.datetime(2011, 1, 1, 12))

        self.project_billable = factories.BillableProject()
        self.project_billable2 = factories.BillableProject()
        self.project_non_billable = factories.NonbillableProject()

        self.entry1 = factories.Entry(
            user=self.user,
            project=self.project_billable,
            activity=factories.Activity(billable=True),
            start_time=start,
            end_time=end,
            status=Entry.APPROVED)
        self.entry2 = factories.Entry(
            user=self.user,
            project=self.project_billable,
            activity=factories.Activity(billable=True),
            start_time=start - relativedelta(days=5),
            end_time=end - relativedelta(days=5),
            status=Entry.APPROVED)
        self.entry3 = factories.Entry(
            user=self.user,
            project=self.project_billable2,
            activity=factories.Activity(billable=False),
            start_time=start - relativedelta(days=10),
            end_time=end - relativedelta(days=10),
            status=Entry.APPROVED)
        self.entry4 = factories.Entry(user=self.user,
                                      project=self.project_non_billable,
                                      start_time=start +
                                      relativedelta(hours=11),
                                      end_time=end + relativedelta(hours=15),
                                      status=Entry.APPROVED)

        # Default get kwargs.
        self.to_date = utils.add_timezone(
            datetime.datetime(2011, 1, 31, 0, 0, 0))
        self.get_kwargs = {
            'to_date': self.to_date.strftime(DATE_FORM_FORMAT),
            'statuses': list(Attribute.statuses.values_list('pk', flat=True)),
        }
Ejemplo n.º 6
0
    def setUp(self):
        self.user = factories.User()
        permissions = Permission.objects.filter(
            content_type=ContentType.objects.get_for_model(Entry),
            codename__in=('can_clock_in', 'can_clock_out', 'can_pause',
                          'change_entry'))
        self.user.user_permissions = permissions
        self.user.save()
        self.superuser = factories.Superuser()

        self.tracked_status = factories.StatusAttribute(
            label='Current', billable=True, enable_timetracking=True)
        self.untracked_status = factories.StatusAttribute(
            label='Closed', billable=False, enable_timetracking=False)
        self.tracked_type = factories.TypeAttribute(
            label='Tracked', billable=True, enable_timetracking=True)
        self.untracked_type = factories.TypeAttribute(
            label='Untracked', billable=False, enable_timetracking=False)

        self.work_activities = factories.ActivityGroup(name='Work')
        self.leave_activities = factories.ActivityGroup(name='Leave')
        self.all_activities = factories.ActivityGroup(name='All')

        self.leave_activity = factories.Activity(
            code='leave', name='Leave', billable=False)
        self.leave_activity.activity_group.add(
            self.leave_activities, self.all_activities)
        self.work_activity = factories.Activity(
            code='work', name='Work', billable=True)
        self.work_activity.activity_group.add(
            self.work_activities, self.all_activities)

        data = {
            'type': self.tracked_type,
            'status': self.tracked_status,
            'activity_group': self.work_activities,
        }
        self.tracked_project = factories.BillableProject(
            name='Tracked', **data)
        data = {
            'type': self.untracked_type,
            'status': self.untracked_status,
            'activity_group': self.all_activities,
        }
        self.untracked_project = factories.BillableProject(
            name='Untracked', **data)
Ejemplo n.º 7
0
 def setUp(self):
     super(InvoiceViewPreviousTestCase, self).setUp()
     self.user = factories.Superuser()
     self.login_user(self.user)
     self.devl_activity = factories.Activity(code='devl',
                                             name='development',
                                             billable=True)
     self.activity = factories.Activity(code='WRK', name='Work')
     # Make some projects and entries for invoice creation
     self.project = factories.BillableProject()
     self.project2 = factories.BillableProject()
     last_start = self.log_many([self.project, self.project2])
     # Add some non-billable entries
     self.log_many([self.project, self.project2],
                   start=last_start,
                   billable=False)
     self.create_invoice(self.project, {'static': EntryGroup.INVOICED})
     self.create_invoice(self.project2, {'status': EntryGroup.NOT_INVOICED})
Ejemplo n.º 8
0
 def setUp(self):
     super(InvoiceCreateTestCase, self).setUp()
     self.user = factories.Superuser()
     self.login_user(self.user)
     start = utils.add_timezone(datetime.datetime(2011, 1, 1, 8))
     end = utils.add_timezone(datetime.datetime(2011, 1, 1, 12))
     self.project_billable = factories.BillableProject()
     self.project_billable2 = factories.BillableProject()
     self.project_non_billable = factories.NonbillableProject()
     self.entry1 = factories.Entry(
         user=self.user,
         project=self.project_billable,
         activity=factories.Activity(billable=True),
         start_time=start,
         end_time=end,
         status=Entry.APPROVED)
     self.entry2 = factories.Entry(
         user=self.user,
         project=self.project_billable,
         activity=factories.Activity(billable=True),
         start_time=start - relativedelta(days=5),
         end_time=end - relativedelta(days=5),
         status=Entry.APPROVED)
     self.entry3 = factories.Entry(
         user=self.user,
         project=self.project_billable2,
         activity=factories.Activity(billable=False),
         start_time=start - relativedelta(days=10),
         end_time=end - relativedelta(days=10),
         status=Entry.APPROVED)
     self.entry4 = factories.Entry(user=self.user,
                                   project=self.project_non_billable,
                                   start_time=start +
                                   relativedelta(hours=11),
                                   end_time=end + relativedelta(hours=15),
                                   status=Entry.APPROVED)