Ejemplo n.º 1
0
    def test_content(self):
        """Test that the quote content is populated as expected."""
        hourly_rate = HourlyRateFactory(rate_value=1250,
                                        vat_value=Decimal(17.5))
        company = CompanyFactory(
            name='My *Coorp',
            registered_address_1='line 1',
            registered_address_2='*line 2',
            registered_address_town='London',
            registered_address_county='County',
            registered_address_postcode='SW1A 1AA',
            registered_address_country_id=Country.united_kingdom.value.id,
            company_number='123456789',
        )
        contact = ContactFactory(
            company=company,
            first_name='John',
            last_name='*Doe',
        )
        order = OrderFactory(
            delivery_date=dateutil_parse('2017-06-20'),
            company=company,
            contact=contact,
            reference='ABC123',
            primary_market_id=Country.france.value.id,
            description='lorem *ipsum',
            discount_value=100,
            hourly_rate=hourly_rate,
            assignees=[],
            vat_status=VATStatus.uk,
            contact_email='*****@*****.**',
        )
        OrderAssigneeFactory(
            order=order,
            adviser=AdviserFactory(
                first_name='Foo',
                last_name='*Bar',
            ),
            estimated_time=150,
            is_lead=True,
        )

        content = generate_quote_content(
            order=order,
            expires_on=dateutil_parse('2017-05-18').date(),
        )
        with open(COMPILED_QUOTE_TEMPLATE, 'r', encoding='utf-8') as f:
            expected_content = f.read()

        assert content == expected_content
Ejemplo n.º 2
0
    def test_without_applied_vat(self, fields):
        """Test when the VAT status doesn't require the VAT to be applied."""
        hourly_rate = HourlyRateFactory(rate_value=110,
                                        vat_value=Decimal(19.5))
        order = OrderFactory(
            **fields,
            discount_value=100,
            hourly_rate=hourly_rate,
            assignees=[],
        )
        OrderAssigneeFactory(order=order, estimated_time=140)

        pricing = calculate_order_pricing(order)

        assert pricing.net_cost == 257
        assert pricing.subtotal_cost == 157
        assert pricing.vat_cost == 0
        assert pricing.total_cost == 157
Ejemplo n.º 3
0
    def test_pricing_format(self):
        """Test that the pricing is formatted as expected (xx.yy)"""
        hourly_rate = HourlyRateFactory(rate_value=1250, vat_value=Decimal(20))
        order = OrderFactory(
            discount_value=0,
            hourly_rate=hourly_rate,
            assignees=[],
            vat_status=VATStatus.uk,
        )
        OrderAssigneeFactory(
            order=order,
            estimated_time=120,
            is_lead=True,
        )

        content = generate_quote_content(
            order=order,
            expires_on=dateutil_parse('2017-05-18').date(),
        )

        assert '25.00' in content