def test_report_time_by_ticket():
    user = UserFactory(username='******')
    d = timezone.now().date()
    t1 = TicketFactory(pk=1, contact=ContactFactory())
    TimeRecordFactory(
        ticket=t1,
        date_started=d,
        start_time=time(11, 0),
        end_time=time(11, 30),
        user=user,
    )
    TimeRecordFactory(
        ticket=TicketFactory(pk=2, contact=ContactFactory()),
        date_started=d,
        start_time=time(10, 0),
        end_time=time(10, 15),
        user=user,
    )
    # another date (so not included)
    TimeRecordFactory(
        ticket=t1,
        date_started=d + relativedelta(days=-1),
        start_time=time(12, 0),
        end_time=time(12, 10),
        user=UserFactory(),
    )
    # another user (so not included)
    TimeRecordFactory(
        ticket=t1,
        date_started=d,
        start_time=time(12, 0),
        end_time=time(12, 10),
        user=UserFactory(),
    )
    TimeRecordFactory(
        ticket=t1,
        date_started=d,
        start_time=time(12, 0),
        end_time=time(12, 10),
        user=user,
    )
    data = TimeRecord.objects.report_time_by_ticket(user, d)
    assert {
        1: {
            'Chargeable': 40.0,
            'Fixed-Price': 0,
            'Non-Chargeable': 0
        },
        2: {
            'Chargeable': 15.0,
            'Fixed-Price': 0,
            'Non-Chargeable': 0
        },
    } == data
Пример #2
0
def test_invoice_create_time(perm_check):
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    url = reverse('invoice.create.time', kwargs={'pk': contact.pk})
    perm_check.staff(url)
Пример #3
0
def test_invoice_contact_update(perm_check):
    contact = ContactFactory()
    invoice_contact = InvoiceContactFactory(contact=contact)
    url = reverse(
        'invoice.contact.update',
        kwargs={'pk': invoice_contact.pk}
    )
    perm_check.staff(url)
Пример #4
0
def test_contact():
    contact = ContactFactory()
    TicketFactory(contact=contact, due=date.today(), title='t1')
    TicketFactory(contact=contact, title='t2')
    TicketFactory(contact=contact, complete=timezone.now(), title='t3')
    TicketFactory(title='t4')
    qs = Ticket.objects.contact(contact)
    assert ['t3', 't2', 't1'] == [obj.title for obj in qs]
 def test_invoice_create_pdf(self):
     InvoiceSettingsFactory()
     VatSettingsFactory()
     contact = ContactFactory()
     InvoiceContactFactory(contact=contact)
     ticket = TicketFactory(contact=contact)
     TimeRecordFactory(ticket=ticket, date_started=date(2013, 12, 1))
     invoice = InvoiceCreate().create(UserFactory(), contact,
                                      date(2013, 12, 31))
     InvoicePrint().create_pdf(invoice, None)
def test_to_invoice():
    contact = ContactFactory()
    d = date(2012, 7, 1)
    #
    TimeRecordFactory(
        title='t1',
        ticket=TicketFactory(contact=contact),
        date_started=d,
    )
    # exclude records created after the invoice date
    TimeRecordFactory(
        title='t2',
        ticket=TicketFactory(contact=contact),
        date_started=date(2012, 8, 1),
    )
    # exclude records for another contact
    TimeRecordFactory(
        title='t3',
        ticket=TicketFactory(contact=ContactFactory()),
        date_started=d,
    )
    # exclude records which have already been invoiced
    TimeRecordFactory(
        title='t4',
        ticket=TicketFactory(contact=contact),
        date_started=d,
        invoice_line=InvoiceLineFactory(),
    )
    # exclude records which have a fixed price ticket
    TimeRecordFactory(
        title='t5',
        ticket=TicketFactory(contact=contact, fixed_price=True),
        date_started=d,
    )
    #
    TimeRecordFactory(
        title='t6',
        ticket=TicketFactory(contact=contact),
        date_started=d,
    )
    qs = TimeRecord.objects.to_invoice(contact, date(2012, 7, 31))
    assert ['t1', 't6'] == [x.title for x in qs]
def test_report_time_by_contact_user():
    user = UserFactory()
    to_date = timezone.now()
    from_date = to_date + relativedelta(months=-1)
    d = from_date + relativedelta(days=7)
    bob = TicketFactory(contact=ContactFactory(slug='bob'))
    sam = TicketFactory(contact=ContactFactory(slug='sam'))
    # these time records are for a different user, so exclude them
    TimeRecordFactory(
        ticket=bob,
        billable=True,
        date_started=d,
        start_time=time(11, 0),
        end_time=time(11, 30),
    )
    TimeRecordFactory(
        ticket=sam,
        billable=False,
        date_started=d,
        start_time=time(10, 0),
        end_time=time(10, 15),
    )
    # include these time records
    TimeRecordFactory(
        ticket=bob,
        billable=True,
        date_started=d,
        start_time=time(11, 0),
        end_time=time(11, 30),
        user=user,
    )
    TimeRecordFactory(
        ticket=sam,
        billable=False,
        date_started=d,
        start_time=time(10, 0),
        end_time=time(10, 15),
        user=user,
    )
    data = TimeRecord.objects.report_time_by_contact(from_date, to_date, user)
    assert {'bob': 30, 'sam': 15} == data
def test_report_time_by_contact():
    to_date = timezone.now()
    from_date = to_date + relativedelta(months=-1)
    d = from_date + relativedelta(days=7)
    ticket = TicketFactory(contact=ContactFactory(slug='bob'))
    TimeRecordFactory(
        ticket=ticket,
        billable=True,
        date_started=d,
        start_time=time(11, 0),
        end_time=time(11, 30),
    )
    ticket = TicketFactory(contact=ContactFactory(slug='sam'))
    TimeRecordFactory(
        ticket=ticket,
        billable=False,
        date_started=d,
        start_time=time(10, 0),
        end_time=time(10, 15),
    )
    data = TimeRecord.objects.report_time_by_contact(from_date, to_date)
    assert {'bob': 30, 'sam': 15} == data
def test_create_invoices_do_not_bill_twice():
    """Check we can't include the time records more than once"""
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    ticket = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=ticket, date_started=date(2012, 7, 1))
    user = UserFactory()
    InvoiceCreateBatch().create(user, date(2012, 9, 30))
    assert 1 == Invoice.objects.filter(contact=contact).count()
    InvoiceCreateBatch().create(user, date(2012, 9, 30))
    assert 1 == Invoice.objects.filter(contact=contact).count()
Пример #10
0
def test_api_ticket(api_client):
    user = UserFactory(first_name='Andrea', username='******')
    t1 = TicketFactory(
        contact=ContactFactory(company_name='', user=user),
        priority=PriorityFactory(name='Medium'),
        title='Mow the lawn',
        user_assigned=UserFactory(username='******'),
    )
    user = UserFactory(first_name='Patrick', username='******')
    t2 = TicketFactory(
        contact=ContactFactory(company_name='', user=user),
        priority=PriorityFactory(name='High'),
        title='Make a cup of tea',
        user_assigned=UserFactory(username='******'),
    )
    # get
    response = api_client.get(reverse('api.crm.ticket'))
    assert status.HTTP_200_OK == response.status_code
    assert [
        {
            'contact': 'andrea',
            'due': None,
            'id': t1.pk,
            'priority': 'Medium',
            'title': 'Mow the lawn',
            'username': '******',
        },
        {
            'contact': 'patrick',
            'due': None,
            'id': t2.pk,
            'priority': 'High',
            'title': 'Make a cup of tea',
            'username': '******',
        },
    ] == response.data
def test_create_invoices_only_billable_time():
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    ticket = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=ticket, date_started=date(2012, 7, 1))
    InvoiceCreateBatch().create(UserFactory(), date(2012, 9, 30))
    TimeRecordFactory(
        ticket=ticket,
        date_started=date(2012, 7, 1),
        billable=False,
    )
    InvoiceCreateBatch().create(UserFactory(), date(2012, 9, 30))
    assert 1 == Invoice.objects.filter(contact=contact).count()
Пример #12
0
def test_invoice_download(perm_check):
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    ticket = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=ticket, date_started=date(2013, 12, 1))
    invoice = InvoiceCreate().create(
        UserFactory(),
        contact,
        date(2013, 12, 31)
    )
    InvoicePrint().create_pdf(invoice, header_image=None)
    url = reverse('invoice.download', kwargs={'pk': invoice.pk})
    perm_check.staff(url)
def test_invoice_with_time_records_no_end_time():
    """One of the time records has no end time, so cannot be invoiced."""
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    ticket = TicketFactory(contact=contact)
    tr1 = TimeRecordFactory(ticket=ticket)
    TimeRecordFactory(ticket=ticket, end_time=None)
    TimeRecordFactory(ticket=ticket)
    with pytest.raises(InvoiceError) as ex:
        InvoiceCreate().create(tr1.user, contact, date.today())
    message = str(ex.value)
    assert 'does not have a' in message
    assert 'end time' in message
def test_create_invoices():
    """Create an invoice"""
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    ticket = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=ticket, date_started=date(2012, 7, 1))
    TimeRecordFactory(ticket=ticket, date_started=date(2012, 8, 1))
    TimeRecordFactory(ticket=ticket)
    # action
    InvoiceCreateBatch().create(UserFactory(), date(2012, 9, 30))
    invoices = Invoice.objects.filter(contact=contact)
    assert 1 == len(invoices)
    invoice = invoices[0]
    assert 2 == len(invoice.invoiceline_set.all())
def test_invoice_with_time_records():
    """Invoice time records."""
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    ticket = TicketFactory(contact=contact)
    tr1 = TimeRecordFactory(ticket=ticket)
    TimeRecordFactory(ticket=ticket)
    invoice = InvoiceCreate().create(
        tr1.user, contact, date.today()
    )
    assert invoice.is_draft
    InvoicePrint().create_pdf(invoice, None)
    assert not invoice.is_draft
    assert Decimal('40.00') == invoice.net
def test_invoice_create_draft(client):
    user = UserFactory(username='******', is_staff=True)
    assert client.login(username=user.username, password=TEST_PASSWORD) is True
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    assert 0 == Invoice.objects.count()
    url = reverse('invoice.create.draft', kwargs={'pk': contact.pk})
    data = {
        'invoice_date': timezone.now().date(),
    }
    response = client.post(url, data)
    assert 302 == response.status_code, response.context['form'].errors
    assert 1 == Invoice.objects.count()
    invoice = Invoice.objects.first()
    assert invoice.number == 1
    assert invoice.invoice_number == '000001'
def test_report_total_by_user():
    contact = ContactFactory()
    invoice = InvoiceFactory(contact=contact)
    InvoiceSettingsFactory()
    # no time records
    InvoiceLineFactory(invoice=invoice)
    # u1's time records
    invoice_line = InvoiceLineFactory(invoice=invoice)
    t1 = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=t1,
                      user=UserFactory(username='******'),
                      invoice_line=invoice_line)
    # u2's time records
    invoice_line = InvoiceLineFactory(invoice=invoice)
    u2 = UserFactory(username='******')
    t2 = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=t2, user=u2, invoice_line=invoice_line)
    invoice_line = InvoiceLineFactory(invoice=invoice)
    t3 = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=t3, user=u2, invoice_line=invoice_line)
    result = invoice.time_analysis()
    # invoice has a line with no time records
    assert '' in result
    # fred recorded time on one ticket
    assert 'u1' in result
    u1 = result['u1']
    assert 1 == len(u1)
    assert t1.pk in u1
    # sara recorded time on two tickets
    assert 'u2' in result
    u2 = result['u2']
    assert 2 == len(u2)
    assert t2.pk in u2
    assert t3.pk in u2
    # web user added an invoice line, but didn't record time
    assert 'web' not in result
    # check net total matches invoice
    net = Decimal()
    for user, tickets in result.items():
        for ticket_pk, totals in tickets.items():
            net = net + totals['net']
    assert invoice.net == net
def test_create_invoices_not_fixed_price():
    InvoiceSettingsFactory()
    VatSettingsFactory()
    contact = ContactFactory()
    InvoiceContactFactory(contact=contact)
    # ticket 1
    t1 = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=t1, title='t1', date_started=date(2012, 7, 1))
    # ticket 2 is for fixed price work
    t2 = TicketFactory(contact=contact, fixed_price=True)
    TimeRecordFactory(ticket=t2, title='t2', date_started=date(2012, 7, 2))
    # ticket 3
    t3 = TicketFactory(contact=contact)
    TimeRecordFactory(ticket=t3, title='t3', date_started=date(2012, 7, 3))
    # test
    InvoiceCreateBatch().create(UserFactory(), date(2012, 9, 30))
    assert 1 == Invoice.objects.filter(contact=contact).count()
    invoice = Invoice.objects.get(contact=contact)
    assert ['t1', 't3'] == [
        x.timerecord.title for x in InvoiceLine.objects.filter(invoice=invoice)
    ]
def test_str_no_hourly_rate():
    user = UserFactory(first_name='Alan', last_name='Jones')
    contact = ContactFactory(user=user)
    obj = CrmContactFactory(contact=contact, industry=None)
    assert 'Alan Jones' == str(obj)
def test_str():
    user = UserFactory(first_name='Alan', last_name='Jones')
    contact = ContactFactory(user=user)
    industry = IndustryFactory(name='Agri')
    obj = CrmContactFactory(contact=contact, industry=industry)
    assert 'Alan Jones: Agri' == str(obj)
def test_get_absolute_url():
    contact = ContactFactory(user=UserFactory(username='******'))
    obj = CrmContactFactory(contact=contact)
    expect = reverse('contact.detail', args=[contact.pk])
    assert expect == obj.get_absolute_url()
Пример #22
0
def test_time_summary_by_user():
    user = UserFactory(username='******', first_name='P', last_name='Kimber')
    contact = ContactFactory(user=user)
    TimeRecordFactory(
        ticket=TicketFactory(contact=contact),
        date_started=date(2017, 1, 16),
        start_time=time(11, 0),
        end_time=time(11, 30),
        user=user,
    )
    TimeRecordFactory(
        billable=False,
        ticket=TicketFactory(contact=contact),
        date_started=date(2016, 12, 1),
        start_time=time(11, 0),
        end_time=time(11, 15),
        user=user,
    )
    TimeRecordFactory(
        ticket=TicketFactory(contact=contact, fixed_price=True),
        date_started=date(2016, 11, 30),
        start_time=time(11, 0),
        end_time=time(11, 10),
        user=user,
    )
    assert 0 == ReportSchedule.objects.count()
    # test the task
    time_summary_by_user()
    assert 1 == ReportSchedule.objects.count()
    report_schedule = ReportSchedule.objects.first()
    reader = csv.reader(open(report_schedule.full_path), 'excel')
    first_row = None
    result = []
    for row in reader:
        if not first_row:
            first_row = row
        else:
            # check the values in the last three columns (dates will change)
            result.append(row[4:])
        print(row)
    assert [
        'user_name',
        'year',
        'month',
        'label',
        'non_minutes',
        'fixed_minutes',
        'charge_minutes',
    ] == first_row
    assert [
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '0', '0'],
        ['0', '10', '0'],
        ['15', '0', '0'],
        ['0', '0', '30'],
        ['0', '0', '0'],
        ['0', '0', '0'],
    ] == result
def test_time_summary_by_user():
    user = UserFactory(username='******', first_name='P', last_name='Kimber')
    contact = ContactFactory(user=user)
    TimeRecordFactory(
        ticket=TicketFactory(contact=contact),
        date_started=date(2017, 1, 16),
        start_time=time(11, 0),
        end_time=time(11, 30),
        user=user,
    )
    TimeRecordFactory(
        billable=False,
        ticket=TicketFactory(contact=contact),
        date_started=date(2016, 12, 1),
        start_time=time(11, 0),
        end_time=time(11, 15),
        user=user,
    )
    TimeRecordFactory(
        ticket=TicketFactory(contact=contact, fixed_price=True),
        date_started=date(2016, 11, 30),
        start_time=time(11, 0),
        end_time=time(11, 10),
        user=user,
    )
    data = time_summary_by_user(date(2017, 3, 17))
    assert {
        'green': {
            '2015-03': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Mar',
                'month': 3,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-04': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Apr',
                'month': 4,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-05': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'May',
                'month': 5,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-06': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Jun',
                'month': 6,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-07': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Jul',
                'month': 7,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-08': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Aug',
                'month': 8,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-09': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Sep',
                'month': 9,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-10': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Oct',
                'month': 10,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-11': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Nov',
                'month': 11,
                'non_minutes': 0,
                'year': 2015,
            },
            '2015-12': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Dec',
                'month': 12,
                'non_minutes': 0,
                'year': 2015,
            },
            '2016-01': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Jan',
                'month': 1,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-02': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Feb',
                'month': 2,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-03': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Mar',
                'month': 3,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-04': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Apr',
                'month': 4,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-05': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'May',
                'month': 5,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-06': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Jun',
                'month': 6,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-07': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Jul',
                'month': 7,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-08': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Aug',
                'month': 8,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-09': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Sep',
                'month': 9,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-10': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Oct',
                'month': 10,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-11': {
                'charge_minutes': 0,
                'fixed_minutes': 10,
                'label': 'Nov',
                'month': 11,
                'non_minutes': 0,
                'year': 2016,
            },
            '2016-12': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Dec',
                'month': 12,
                'non_minutes': 15,
                'year': 2016,
            },
            '2017-01': {
                'charge_minutes': 30.0,
                'fixed_minutes': 0,
                'label': 'Jan',
                'month': 1,
                'non_minutes': 0,
                'year': 2017,
            },
            '2017-02': {
                'charge_minutes': 0,
                'fixed_minutes': 0,
                'label': 'Feb',
                'month': 2,
                'non_minutes': 0,
                'year': 2017,
            },
        }
    } == data
def test_time_summary():
    user = UserFactory(username='******', first_name='P', last_name='Kimber')
    d = date(2017, 4, 16)
    contact = ContactFactory(
        user=UserFactory(username='******', first_name='O', last_name='Rind'))
    t1 = TicketFactory(pk=1, contact=ContactFactory(user=user))
    TimeRecordFactory(
        ticket=t1,
        date_started=d,
        start_time=time(11, 0),
        end_time=time(11, 30),
        user=user,
    )
    contact = ContactFactory(
        user=UserFactory(username='******', first_name='A', last_name='Teal'))
    TimeRecordFactory(
        ticket=TicketFactory(pk=2, contact=contact),
        date_started=d,
        start_time=time(10, 0),
        end_time=time(10, 15),
        user=user,
    )
    # another date (so not included)
    TimeRecordFactory(
        ticket=t1,
        date_started=d + relativedelta(days=-1),
        start_time=time(12, 0),
        end_time=time(12, 10),
        user=UserFactory(),
    )
    # another user (so not included)
    TimeRecordFactory(
        ticket=t1,
        date_started=d,
        start_time=time(12, 0),
        end_time=time(12, 10),
        user=UserFactory(),
    )
    TimeRecordFactory(
        ticket=t1,
        date_started=d,
        start_time=time(12, 0),
        end_time=time(12, 10),
        user=user,
    )
    data = time_summary(user)
    assert {
        date(2017, 4, 16): {
            'tickets': [{
                'analysis': {
                    'charge_minutes': 40.0,
                    'charge_minutes_format': '00:40',
                    'fixed_minutes': 0,
                    'fixed_minutes_format': '00:00',
                    'non_minutes': 0,
                    'non_minutes_format': '00:00'
                },
                'contact': 'P Kimber',
                'description': '',
                'pk': 1,
                'user_name': 'green'
            }, {
                'analysis': {
                    'charge_minutes': 15.0,
                    'charge_minutes_format': '00:15',
                    'fixed_minutes': 0,
                    'fixed_minutes_format': '00:00',
                    'non_minutes': 0,
                    'non_minutes_format': '00:00'
                },
                'contact': 'A Teal',
                'description': '',
                'pk': 2,
                'user_name': 'blue'
            }],
            'total':
            55.0,
            'total_format':
            '00:55',
            'total_charge':
            55.0,
            'total_charge_format':
            '00:55',
            'total_fixed':
            0,
            'total_fixed_format':
            '00:00',
            'total_non':
            0,
            'total_non_format':
            '00:00',
        }
    } == data
Пример #25
0
def test_contact_time_record_list(perm_check):
    contact = ContactFactory()
    url = reverse('invoice.time.contact.list', kwargs={'pk': contact.pk})
    perm_check.staff(url)
def test_str():
    user = UserFactory(first_name='Alan', last_name='Jones')
    contact = ContactFactory(user=user)
    obj = InvoiceContactFactory(contact=contact, hourly_rate=Decimal('12.34'))
    assert 'Alan Jones @ 12.34' == str(obj)
Пример #27
0
def test_invoice_contact_create(perm_check):
    contact = ContactFactory()
    url = reverse('invoice.contact.create', kwargs={'pk': contact.pk})
    perm_check.staff(url)
def test_ticket_create(perm_check):
    contact = ContactFactory()
    url = reverse('crm.ticket.create', kwargs={'pk': contact.pk})
    perm_check.staff(url)
def test_contact_detail(perm_check):
    UserContactFactory(user=get_user_web())
    contact = ContactFactory()
    crm_contact = CrmContactFactory(contact=contact)
    url = reverse('contact.detail', args=[contact.pk])
    perm_check.staff(url)
def test_crm_contact_update(perm_check):
    contact = ContactFactory()
    crm_contact = CrmContactFactory(contact=contact)
    url = reverse('crm.contact.update', kwargs={'pk': crm_contact.pk})
    perm_check.staff(url)