Commit f9ce8264 by Clinton Blackburn

Merge pull request #8803 from edx/clintonb/commerce-api-fix

Corrected path to Commerce API
parents 47002ff7 5d356d29
...@@ -41,7 +41,7 @@ class CourseApiViewTestMixin(object): ...@@ -41,7 +41,7 @@ class CourseApiViewTestMixin(object):
class CourseListViewTests(CourseApiViewTestMixin, ModuleStoreTestCase): class CourseListViewTests(CourseApiViewTestMixin, ModuleStoreTestCase):
""" Tests for CourseListView. """ """ Tests for CourseListView. """
path = reverse('commerce:api:v1:courses:list') path = reverse('commerce_api:v1:courses:list')
def test_authentication_required(self): def test_authentication_required(self):
""" Verify only authenticated users can access the view. """ """ Verify only authenticated users can access the view. """
...@@ -72,7 +72,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase) ...@@ -72,7 +72,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
def setUp(self): def setUp(self):
super(CourseRetrieveUpdateViewTests, self).setUp() super(CourseRetrieveUpdateViewTests, self).setUp()
self.path = reverse('commerce:api:v1:courses:retrieve_update', args=[unicode(self.course.id)]) self.path = reverse('commerce_api:v1:courses:retrieve_update', args=[unicode(self.course.id)])
self.user = UserFactory.create() self.user = UserFactory.create()
self.client.login(username=self.user.username, password=PASSWORD) self.client.login(username=self.user.username, password=PASSWORD)
...@@ -103,7 +103,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase) ...@@ -103,7 +103,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
def test_retrieve_invalid_course(self): def test_retrieve_invalid_course(self):
""" The view should return HTTP 404 when retrieving data for a course that does not exist. """ """ The view should return HTTP 404 when retrieving data for a course that does not exist. """
path = reverse('commerce:api:v1:courses:retrieve_update', args=['a/b/c']) path = reverse('commerce_api:v1:courses:retrieve_update', args=['a/b/c'])
response = self.client.get(path, content_type=JSON_CONTENT_TYPE) response = self.client.get(path, content_type=JSON_CONTENT_TYPE)
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
...@@ -134,7 +134,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase) ...@@ -134,7 +134,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
u'modes': [self._serialize_course_mode( u'modes': [self._serialize_course_mode(
CourseMode(mode_slug=u'credit', min_price=500, currency=u'USD', sku=u'ABC123')), ] CourseMode(mode_slug=u'credit', min_price=500, currency=u'USD', sku=u'ABC123')), ]
} }
path = reverse('commerce:api:v1:courses:retrieve_update', args=[course_id]) path = reverse('commerce_api:v1:courses:retrieve_update', args=[course_id])
response = self.client.put(path, json.dumps(expected), content_type=JSON_CONTENT_TYPE) response = self.client.put(path, json.dumps(expected), content_type=JSON_CONTENT_TYPE)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
actual = json.loads(response.content) actual = json.loads(response.content)
...@@ -156,7 +156,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase) ...@@ -156,7 +156,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
CourseMode(mode_slug=u'honor', min_price=0, currency=u'USD', sku=u'DEADBEEF')), CourseMode(mode_slug=u'honor', min_price=0, currency=u'USD', sku=u'DEADBEEF')),
] ]
} }
path = reverse('commerce:api:v1:courses:retrieve_update', args=[course_id]) path = reverse('commerce_api:v1:courses:retrieve_update', args=[course_id])
response = self.client.put(path, json.dumps(expected), content_type=JSON_CONTENT_TYPE, **request_kwargs) response = self.client.put(path, json.dumps(expected), content_type=JSON_CONTENT_TYPE, **request_kwargs)
self.assertEqual(response.status_code, 201) self.assertEqual(response.status_code, 201)
actual = json.loads(response.content) actual = json.loads(response.content)
......
...@@ -13,5 +13,4 @@ urlpatterns = patterns( ...@@ -13,5 +13,4 @@ urlpatterns = patterns(
url(r'^baskets/{}/order/$'.format(BASKET_ID_PATTERN), views.BasketOrderView.as_view(), name="basket_order"), url(r'^baskets/{}/order/$'.format(BASKET_ID_PATTERN), views.BasketOrderView.as_view(), name="basket_order"),
url(r'^checkout/cancel/$', views.checkout_cancel, name="checkout_cancel"), url(r'^checkout/cancel/$', views.checkout_cancel, name="checkout_cancel"),
url(r'^checkout/receipt/$', views.checkout_receipt, name="checkout_receipt"), url(r'^checkout/receipt/$', views.checkout_receipt, name="checkout_receipt"),
url(r'^api/', include('commerce.api.urls', namespace='api'))
) )
...@@ -89,6 +89,8 @@ urlpatterns = ( ...@@ -89,6 +89,8 @@ urlpatterns = (
# Video Abstraction Layer used to allow video teams to manage video assets # Video Abstraction Layer used to allow video teams to manage video assets
# independently of courseware. https://github.com/edx/edx-val # independently of courseware. https://github.com/edx/edx-val
url(r'^api/val/v0/', include('edxval.urls')), url(r'^api/val/v0/', include('edxval.urls')),
url(r'^api/commerce/', include('commerce.api.urls', namespace='commerce_api')),
) )
# Full Course/Library Import/Export API # Full Course/Library Import/Export API
......
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