Пример #1
0
def test_gen_invoices_one(business, full_estimation, user):
    BusinessService.populate_deadlines(business)

    invoices = BusinessService.gen_invoices(business, user,
                                            business.payment_deadlines[1])
    assert len(invoices) == 1
    assert business.payment_deadlines[1].invoice == invoices[0]
Пример #2
0
def test_is_visible(dbsession, business, project, mk_project_type):
    business.project = project
    dbsession.merge(business)
    assert BusinessService.is_default_project_type(business) == True
    project.project_type = mk_project_type(name="newone")
    dbsession.merge(project)
    assert BusinessService.is_default_project_type(business) == False
Пример #3
0
def test_find_deadline_from_invoice(dbsession, business, invoice):
    BusinessService.populate_deadlines(business)
    business.payment_deadlines[1].invoice = invoice
    dbsession.merge(business.payment_deadlines[1])
    dbsession.flush()

    assert BusinessService.find_deadline_from_invoice(business, invoice) == \
        business.payment_deadlines[1]
Пример #4
0
def test_gen_invoices_all(business, full_estimation, user):
    BusinessService.populate_deadlines(business)

    invoices = BusinessService.gen_invoices(
        business,
        user,
    )
    assert len(invoices) == 3
    for i in range(2):
        assert business.payment_deadlines[i].invoice == invoices[i]
Пример #5
0
def test_update_invoicing_status(dbsession, business, invoice):
    from autonomie.models.services.business import BusinessService
    BusinessService.populate_deadlines(business)

    deadline = business.payment_deadlines[0]
    deadline.invoice = invoice
    dbsession.merge(deadline)
    dbsession.flush()
    BusinessStatusService.update_invoicing_status(business, invoice)
    assert deadline.invoiced is True
Пример #6
0
def test_update_invoicing_indicator(business, invoice):
    from autonomie.models.services.business import BusinessService
    BusinessService.populate_deadlines(business)
    BusinessStatusService.populate_indicators(business)

    BusinessStatusService.update_invoicing_indicator(business)
    assert business.indicators[0].status == u"danger"

    for deadline in business.payment_deadlines:
        deadline.invoiced = True

    BusinessStatusService.update_invoicing_indicator(business)
    assert business.indicators[0].status == u"success"
Пример #7
0
def test_to_invoice(business, full_estimation):
    assert BusinessService.to_invoice(business) == full_estimation.ht
Пример #8
0
def test_populate_find_deadline(business):
    BusinessService.populate_deadlines(business)
    id_ = business.payment_deadlines[1].id
    assert BusinessService.find_deadline(business, id_) == \
        business.payment_deadlines[1]
Пример #9
0
def test_populate_deadlines(business, full_estimation):
    BusinessService.populate_deadlines(business)
    assert len(business.payment_deadlines) == 3
    for deadline in business.payment_deadlines:
        assert deadline.invoiced is False
    assert business.status == "danger"
Пример #10
0
def test_get_customer_id(business, full_estimation):
    result = BusinessService._get_customer_id(business)
    assert result == full_estimation.customer_id