diff --git a/ecommerce/extensions/api/v2/tests/views/test_refunds.py b/ecommerce/extensions/api/v2/tests/views/test_refunds.py index d596b1a4180..df04e8bf56c 100644 --- a/ecommerce/extensions/api/v2/tests/views/test_refunds.py +++ b/ecommerce/extensions/api/v2/tests/views/test_refunds.py @@ -19,14 +19,14 @@ from ecommerce.extensions.refund.tests.factories import RefundFactory, RefundLineFactory from ecommerce.extensions.refund.tests.mixins import RefundTestMixin from ecommerce.extensions.test.factories import create_order -from ecommerce.tests.mixins import JwtMixin, ThrottlingMixin +from ecommerce.tests.mixins import ThrottlingMixin from ecommerce.tests.testcases import TestCase Option = get_model('catalogue', 'Option') Refund = get_model('refund', 'Refund') -class RefundCreateViewTests(RefundTestMixin, AccessTokenMixin, JwtMixin, TestCase): +class RefundCreateViewTests(RefundTestMixin, AccessTokenMixin, TestCase): MODEL_LOGGER_NAME = 'ecommerce.core.models' path = reverse('api:v2:refunds:create') @@ -104,7 +104,7 @@ def test_jwt_authentication(self): self.client.logout() data = self._get_data(self.user.username, self.course_id) - auth_header = 'JWT ' + self.generate_token({'username': self.user.username}) + auth_header = self.generate_jwt_token_header(self.user) response = self.client.post(self.path, data, JSON_CONTENT_TYPE, HTTP_AUTHORIZATION=auth_header) self.assert_ok_response(response) diff --git a/ecommerce/extensions/offer/tests/test_dynamic_conditional_offer.py b/ecommerce/extensions/offer/tests/test_dynamic_conditional_offer.py index cc42fe90f2a..a3ce50c5a1d 100644 --- a/ecommerce/extensions/offer/tests/test_dynamic_conditional_offer.py +++ b/ecommerce/extensions/offer/tests/test_dynamic_conditional_offer.py @@ -43,7 +43,7 @@ class DynamicPercentageDiscountBenefitTests(BenefitTestMixin, TestCase): @override_flag(DYNAMIC_DISCOUNT_FLAG, active=True) @patch('crum.get_current_request') - @patch('ecommerce.extensions.offer.dynamic_conditional_offer.jwt_decode_handler', + @patch('ecommerce.extensions.offer.dynamic_conditional_offer.configured_jwt_decode_handler', side_effect=_mock_jwt_decode_handler) @patch('ecommerce.enterprise.utils.get_decoded_jwt', side_effect=_mock_get_decoded_jwt) @@ -104,7 +104,7 @@ def test_name(self): @override_flag(DYNAMIC_DISCOUNT_FLAG, active=True) @patch('crum.get_current_request') - @patch('ecommerce.extensions.offer.dynamic_conditional_offer.jwt_decode_handler', + @patch('ecommerce.extensions.offer.dynamic_conditional_offer.configured_jwt_decode_handler', side_effect=_mock_jwt_decode_handler) @ddt.data( {'discount_applicable': True, 'discount_percent': 15}, diff --git a/ecommerce/management/tests/test_views.py b/ecommerce/management/tests/test_views.py index b2c460e057c..232821a8235 100644 --- a/ecommerce/management/tests/test_views.py +++ b/ecommerce/management/tests/test_views.py @@ -45,9 +45,12 @@ def test_invalid_action(self): self.assert_first_message(response, messages.ERROR, 'invalid-action is not a valid action.') def test_refund_basket_transactions(self): - with mock.patch('ecommerce.management.utils.refund_basket_transactions') as mock_refund: + success_count = 0 + failed_count = 0 + result = (success_count, failed_count) + with mock.patch('ecommerce.management.views.refund_basket_transactions', return_value=result) as mock_refund: response = self.client.post(self.path, {'action': 'refund_basket_transactions', 'basket_ids': '1,2,3'}) - assert mock_refund.called_once_with(self.site, [1, 2, 3]) + mock_refund.assert_called_once_with(self.site, [1, 2, 3]) assert response.status_code == 200 expected = 'Finished refunding basket transactions. [0] transactions were successfully refunded. ' \