Commit 5b25940c by Jason Bau

shopping cart view tests. coverage full except for debug line

parent a5ee2add
...@@ -67,7 +67,10 @@ class Order(models.Model): ...@@ -67,7 +67,10 @@ class Order(models.Model):
@property @property
def total_cost(self): def total_cost(self):
""" Return the total cost of the order """ """
Return the total cost of the cart. If the order has been purchased, returns total of
all purchased and not refunded items.
"""
return sum(i.line_cost for i in self.orderitem_set.filter(status=self.status)) return sum(i.line_cost for i in self.orderitem_set.filter(status=self.status))
def clear(self): def clear(self):
......
...@@ -26,7 +26,7 @@ def add_course_to_cart(request, course_id): ...@@ -26,7 +26,7 @@ def add_course_to_cart(request, course_id):
PaidCourseRegistration.add_to_order(cart, course_id) PaidCourseRegistration.add_to_order(cart, course_id)
except ItemNotFoundError: except ItemNotFoundError:
return HttpResponseNotFound(_('The course you requested does not exist.')) return HttpResponseNotFound(_('The course you requested does not exist.'))
if request.method == 'GET': if request.method == 'GET': ### This is temporary for testing purposes and will go away before we pull
return HttpResponseRedirect(reverse('shoppingcart.views.show_cart')) return HttpResponseRedirect(reverse('shoppingcart.views.show_cart'))
return HttpResponse(_("Course added to cart.")) return HttpResponse(_("Course added to cart."))
......
...@@ -32,6 +32,8 @@ MITX_FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True ...@@ -32,6 +32,8 @@ MITX_FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True
MITX_FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True MITX_FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True
MITX_FEATURES['ENABLE_SHOPPING_CART'] = True
# Need wiki for courseware views to work. TODO (vshnayder): shouldn't need it. # Need wiki for courseware views to work. TODO (vshnayder): shouldn't need it.
WIKI_ENABLED = True WIKI_ENABLED = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment