Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aht007 committed May 11, 2023
1 parent b8ac3e4 commit 698a194
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ecommerce/bff/subscriptions/tests/test_subscription_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_with_skus(self, mock_embargo_check):

response = self.client.post(url, data={'skus': [product1.stockrecords.first().partner_sku,
product2.stockrecords.first().partner_sku],
'ip_address': self.ip_address, 'user': self.user.username
'user_ip_address': self.ip_address, 'username': self.user.username
})

self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand Down Expand Up @@ -138,6 +138,6 @@ def test_embargo_failure(self, mock_embargo_check):
'user_ip_address': self.ip_address, 'username': self.user.username
})

self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
expected_data = {'error': 'User blocked by embargo check'}
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
expected_data = {'error': 'User blocked by embargo check', 'error_code': 'embargo_failed'}
self.assertCountEqual(json.loads(response.content.decode('utf-8')), expected_data)
4 changes: 2 additions & 2 deletions ecommerce/bff/subscriptions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def post(self, request, *args, **kwargs):
username
)
return Response({'error': 'User blocked by embargo check',
'error_message_id': 'embargo_failed'},
status=status.HTTP_403_FORBIDDEN)
'error_code': 'embargo_failed'},
status=status.HTTP_400_BAD_REQUEST)

for product in available_products:
mode = self._mode_for_product(product)
Expand Down
1 change: 1 addition & 0 deletions ecommerce/extensions/payment/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def embargo_check(user, site, products, ip=None):
Returns:
Bool
"""

courses = []
if not ip:
_, _, ip = parse_tracking_context(user, usage='embargo')
Expand Down

0 comments on commit 698a194

Please sign in to comment.