Skip to content

Commit

Permalink
Remove microsites from shoppingcart
Browse files Browse the repository at this point in the history
DEPR-27
  • Loading branch information
nasthagiri committed May 29, 2019
1 parent 3539f03 commit 3eb5783
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
3 changes: 0 additions & 3 deletions lms/djangoapps/shoppingcart/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ def order_history(user, **kwargs):
for order_item in purchased_order_items:
# Avoid repeated entries for the same order id.
if order_item.order.id not in [item['order_id'] for item in order_history_list]:
# If we are in a Microsite, then include the orders having courses attributed (by ORG) to that Microsite.
# Conversely, if we are not in a Microsite, then include the orders having courses
# not attributed (by ORG) to any Microsite.
order_item_course_id = getattr(order_item, 'course_id', None)
if order_item_course_id:
if (course_org_filter and order_item_course_id.org in course_org_filter) or \
Expand Down
8 changes: 0 additions & 8 deletions lms/djangoapps/shoppingcart/processors/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,4 @@ def get_processor_config():
config = settings.CC_PROCESSOR.get(
settings.CC_PROCESSOR_NAME, {}
)

# Check whether configuration override exists,
# If so, find the configuration-specific cybersource config in the configurations.
# sub-key of the normal processor configuration.
config_key = configuration_helpers.get_value('cybersource_config_key')
if config_key:
config = config['microsites'][config_key]

return config
34 changes: 4 additions & 30 deletions lms/djangoapps/shoppingcart/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,19 +1449,19 @@ def test_upgrade_postpay_callback_emits_ga_event(self):
}
)

def test_shopping_cart_navigation_link_not_in_microsite(self):
def test_shopping_cart_navigation_link(self):
"""
Tests shopping cart link is available in navigation header if request is not from a microsite.
Tests shopping cart link is available in navigation header.
"""
CourseEnrollment.enroll(self.user, self.course_key)
self.add_course_to_user_cart(self.testing_course.id)
resp = self.client.get(reverse('courseware', kwargs={'course_id': text_type(self.course.id)}))
self.assertEqual(resp.status_code, 200)
self.assertIn('<a class="shopping-cart"', resp.content)

def test_shopping_cart_navigation_link_not_in_microsite_and_not_on_courseware(self):
def test_shopping_cart_navigation_link_and_not_on_courseware(self):
"""
Tests shopping cart link is available in navigation header if request is not from a microsite
Tests shopping cart link is available in navigation header
and requested page is not courseware too.
"""
CourseEnrollment.enroll(self.user, self.course_key)
Expand All @@ -1470,32 +1470,6 @@ def test_shopping_cart_navigation_link_not_in_microsite_and_not_on_courseware(se
self.assertEqual(resp.status_code, 200)
self.assertIn('<a class="shopping-cart"', resp.content)

def test_shopping_cart_navigation_link_in_microsite_not_on_courseware(self):
"""
Tests shopping cart link is available in navigation header if request is from a microsite but requested
page is not from courseware.
"""
CourseEnrollment.enroll(self.user, self.course_key)
self.add_course_to_user_cart(self.testing_course.id)
with patch('microsite_configuration.microsite.is_request_in_microsite',
Mock(return_value=True)):
resp = self.client.get(reverse('dashboard'))
self.assertEqual(resp.status_code, 200)
self.assertIn('<a class="shopping-cart"', resp.content)

def test_shopping_cart_navigation_link_in_microsite_courseware_page(self):
"""
Tests shopping cart link is not available in navigation header if request is from a microsite
and requested page is from courseware.
"""
CourseEnrollment.enroll(self.user, self.course_key)
self.add_course_to_user_cart(self.testing_course.id)
with patch('microsite_configuration.microsite.is_request_in_microsite',
Mock(return_value=True)):
resp = self.client.get(reverse('courseware', kwargs={'course_id': text_type(self.course.id)}))
self.assertEqual(resp.status_code, 200)
self.assertNotIn('<a class="shopping-cart"', resp.content)


class ReceiptRedirectTest(SharedModuleStoreTestCase):
"""Test special-case redirect from the receipt page. """
Expand Down

0 comments on commit 3eb5783

Please sign in to comment.