def test_customer_notified(self): """ Test that calling `quote_generated` sends an email notifying the customer that they have to accept the quote. """ order = OrderWithOpenQuoteFactory() notify.client.reset_mock() notify.quote_generated(order) assert notify.client.send_email_notification.called call_args = notify.client.send_email_notification.call_args_list[0][1] assert call_args['email_address'] == order.get_current_contact_email() assert call_args[ 'template_id'] == Template.quote_sent_for_customer.value assert call_args['personalisation'][ 'recipient name'] == order.contact.name assert call_args['personalisation'][ 'embedded link'] == order.get_public_facing_url()
def test_ok_if_order_in_allowed_status(self, allowed_status): """ Test that the quote of an order can be accepted if the order is in one of the allowed statuses. """ order = OrderWithOpenQuoteFactory(status=allowed_status) contact = ContactFactory() order.accept_quote(by=contact) order.refresh_from_db() assert order.status == OrderStatus.quote_accepted assert order.quote.accepted_on assert order.quote.accepted_by == contact assert order.invoice assert order.invoice.billing_company_name == order.billing_company_name assert order.invoice.billing_address_1 == order.billing_address_1 assert order.invoice.billing_address_2 == order.billing_address_2 assert order.invoice.billing_address_town == order.billing_address_town assert order.invoice.billing_address_county == order.billing_address_county assert order.invoice.billing_address_postcode == order.billing_address_postcode assert order.invoice.billing_address_country == order.billing_address_country assert order.invoice.po_number == order.po_number assert order.invoice.contact_email == order.get_current_contact_email()