Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Delete try except if css is not found

michal3edc04b4f42b
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.py
index 1e58d7a34e..636fed3968 100644
--- a/saleor/dashboard/order/views.py
+++ b/saleor/dashboard/order/views.py
@@ -387,11 +387,8 @@ def order_invoice(request, order_pk, group_pk):
static('/images/saleor_logo_black.svg'))}
rendered_template = get_template(
'dashboard/order/pdf/invoice.html').render(ctx)
- try:
- stylesheet = [CSS(
+ stylesheet = [CSS(
url=request.build_absolute_uri(static('/assets/document.css')))]
- except URLFetchingError:
- stylesheet = None
pdf_file = (HTML(string=rendered_template)
.write_pdf(stylesheets=stylesheet))
response = HttpResponse(pdf_file, content_type='application/pdf')
@@ -412,11 +409,8 @@ def order_packing_slip(request, order_pk, group_pk):
static('/images/saleor_logo_black.svg'))}
rendered_template = get_template(
'dashboard/order/pdf/packing_slip.html').render(ctx)
- try:
- stylesheet = [CSS(
+ stylesheet = [CSS(
url=request.build_absolute_uri(static('/assets/document.css')))]
- except URLFetchingError:
- stylesheet = None
pdf_file = (HTML(string=rendered_template)
.write_pdf(stylesheets=stylesheet))
response = HttpResponse(pdf_file, content_type='application/pdf')
diff --git a/tests/dashboard/test_order.py b/tests/dashboard/test_order.py
index 95f3fcb721..8127dfacf6 100644
--- a/tests/dashboard/test_order.py
+++ b/tests/dashboard/test_order.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+import mock
import pytest
from django.core.urlresolvers import reverse
from saleor.dashboard.order.forms import ChangeQuantityForm, MoveItemsForm
@@ -278,8 +279,9 @@ def test_view_split_order_line_with_invalid_data(admin_client, order_with_items_
@pytest.mark.integration
@pytest.mark.django_db
-def test_view_order_invoice(admin_client, order_with_items_and_stock,
- billing_address):
[email protected]('saleor.dashboard.order.views.CSS')
+def test_view_order_invoice(
+ css_patch, admin_client, order_with_items_and_stock, billing_address):
"""
user goes to order details page
user clicks on Invoice button
@@ -302,8 +304,9 @@ def test_view_order_invoice(admin_client, order_with_items_and_stock,
@pytest.mark.integration
@pytest.mark.django_db
-def test_view_order_packing_slips(admin_client, order_with_items_and_stock,
- billing_address):
[email protected]('saleor.dashboard.order.views.CSS')
+def test_view_order_packing_slips(
+ css_patch, admin_client, order_with_items_and_stock, billing_address):
"""
user goes to order details page
user clicks on Packing Slips button