Skip to content

Commit 55e71c0

Browse files
committed
fix: fix test
1 parent 68da628 commit 55e71c0

File tree

16 files changed

+491
-252
lines changed

16 files changed

+491
-252
lines changed

commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def get_edx_refund_info(payment: CTPayment) -> decimal:
7777
refund_amount = decimal.Decimal(0.00)
7878
interaction_id = None
7979
for transaction in payment.transactions:
80+
8081
if transaction.type == TransactionType.CHARGE: # pragma no cover
8182
refund_amount += decimal.Decimal(typed_money_to_string(transaction.amount, money_as_decimal_string=True))
8283
interaction_id = transaction.interaction_id

commerce_coordinator/apps/commercetools/pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def run_filter(self, active_order_management_system, order_number, **kwargs): #
117117
ret_val = {
118118
"order_data": ct_order,
119119
"psp": psp,
120-
"payment_intent_id": payment.interface_id
120+
"payment_intent_id": payment.interface_id if payment else None
121121
}
122122

123123
return ret_val
@@ -298,12 +298,12 @@ class CreateReturnPaymentTransaction(PipelineStep):
298298

299299
def run_filter(
300300
self,
301-
refund_response,
302301
active_order_management_system,
303302
payment_data,
304303
has_been_refunded,
305304
payment_intent_id,
306305
psp,
306+
refund_response=None,
307307
**kwargs
308308
): # pylint: disable=arguments-differ
309309
"""

commerce_coordinator/apps/commercetools/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from commercetools.platform.models import Transaction as CTTransaction
2424
from commercetools.platform.models import TransactionState, TransactionType
2525
from commercetools.platform.models import TypeReference as CTTypeReference
26+
from commercetools.platform.models import TypedMoney as CTTypedMoney
2627
from commercetools.platform.models.state import State as CTLineItemState
2728
from commercetools.platform.models.state import StateTypeEnum as CTStateType
2829
from commercetools.testing import BackendRepository
@@ -201,7 +202,7 @@ def gen_transaction(transaction_type=None, amount=None) -> CTTransaction:
201202
return CTTransaction(
202203
id=uuid4_str(),
203204
type=transaction_type,
204-
amount=amount,
205+
amount=amount,
205206
timestamp=datetime.now(),
206207
state=TransactionState.SUCCESS,
207208
interaction_id='ch_3P9RWsH4caH7G0X11toRGUJf'

commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,14 @@ def get_uut():
273273
# todo this flow is broken
274274
@patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order')
275275
@patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient')
276-
def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal):
276+
@patch.object(CommercetoolsAPIClientMock, 'payment_mock', new_callable=MagicMock)
277+
def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal, custom_payment_mock):
277278
"""
278279
Check calling uut with mock_parameters yields call to client with
279280
expected_data.
280281
"""
281282
mock_values = self.mock
283+
custom_payment_mock.return_value = CTPaymentByKey()
282284

283285
ret_val = self.get_uut()(*self.unpack_for_uut(self.mock.example_payload))
284286

requirements/base.txt

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@
44
#
55
# make upgrade
66
#
7-
amqp==5.2.0
7+
amqp==5.3.1
88
# via kombu
9+
apimatic-core==0.2.17
10+
# via paypal-server-sdk
11+
apimatic-core-interfaces==0.1.5
12+
# via
13+
# apimatic-core
14+
# apimatic-requests-client-adapter
15+
# paypal-server-sdk
16+
apimatic-requests-client-adapter==0.1.6
17+
# via paypal-server-sdk
918
asgiref==3.7.2
1019
# via
1120
# -r requirements/base.in
1221
# django
1322
# django-cors-headers
14-
attrs==24.2.0
23+
attrs==24.3.0
1524
# via -r requirements/base.in
1625
backoff==2.2.1
1726
# via segment-analytics-python
1827
billiard==4.2.1
1928
# via celery
29+
cachecontrol==0.12.14
30+
# via apimatic-requests-client-adapter
2031
celery[redis]==5.4.0
2132
# via -r requirements/base.in
22-
certifi==2024.8.30
33+
certifi==2024.12.14
2334
# via requests
2435
cffi==1.17.1
2536
# via
@@ -48,7 +59,7 @@ coreapi==2.3.3
4859
# openapi-codec
4960
coreschema==0.0.4
5061
# via coreapi
51-
cryptography==43.0.3
62+
cryptography==44.0.0
5263
# via
5364
# pyjwt
5465
# social-auth-core
@@ -58,7 +69,7 @@ defusedxml==0.8.0rc2
5869
# via
5970
# python3-openid
6071
# social-auth-core
61-
django==4.2.16
72+
django==4.2.17
6273
# via
6374
# -c requirements/common_constraints.txt
6475
# -c requirements/constraints.txt
@@ -83,7 +94,7 @@ django-extensions==3.2.3
8394
# via -r requirements/base.in
8495
django-rest-swagger==2.2.0
8596
# via -r requirements/base.in
86-
django-waffle==4.1.0
97+
django-waffle==4.2.0
8798
# via
8899
# -r requirements/base.in
89100
# edx-django-utils
@@ -104,7 +115,7 @@ edx-braze-client==0.2.5
104115
# via -r requirements/base.in
105116
edx-django-release-util==1.4.0
106117
# via -r requirements/base.in
107-
edx-django-utils==7.0.0
118+
edx-django-utils==7.1.0
108119
# via
109120
# -r requirements/base.in
110121
# edx-drf-extensions
@@ -121,32 +132,40 @@ itypes==1.2.0
121132
# via coreapi
122133
jinja2==3.1.4
123134
# via coreschema
135+
jsonpickle==3.3.0
136+
# via apimatic-core
137+
jsonpointer==2.4
138+
# via apimatic-core
124139
kombu==5.4.2
125140
# via celery
126141
markupsafe==3.0.2
127142
# via
128143
# jinja2
129144
# werkzeug
130-
marshmallow==3.23.0
145+
marshmallow==3.23.1
131146
# via
132147
# commercetools
133148
# marshmallow-enum
134149
marshmallow-enum==1.5.1
135150
# via commercetools
136-
mysqlclient==2.2.5
151+
msgpack==1.1.0
152+
# via cachecontrol
153+
mysqlclient==2.2.6
137154
# via -r requirements/base.in
138-
newrelic==10.2.0
155+
newrelic==10.4.0
139156
# via edx-django-utils
140157
oauthlib==3.2.2
141158
# via
142159
# requests-oauthlib
143160
# social-auth-core
144161
openapi-codec==1.3.2
145162
# via django-rest-swagger
146-
openedx-filters==1.11.0
163+
openedx-filters==1.12.0
147164
# via -r requirements/base.in
148-
packaging==24.1
165+
packaging==24.2
149166
# via marshmallow
167+
paypal-server-sdk==0.5.1
168+
# via -r requirements/base.in
150169
pbr==6.1.0
151170
# via stevedore
152171
pillow==11.0.0
@@ -157,7 +176,7 @@ psutil==6.1.0
157176
# via edx-django-utils
158177
pycparser==2.22
159178
# via cffi
160-
pyjwt[crypto]==2.9.0
179+
pyjwt[crypto]==2.10.1
161180
# via
162181
# drf-jwt
163182
# edx-auth-backends
@@ -172,6 +191,7 @@ pynacl==1.5.0
172191
python-dateutil==2.9.0.post0
173192
# via
174193
# -r requirements/base.in
194+
# apimatic-core
175195
# celery
176196
# segment-analytics-python
177197
python3-openid==3.2.0
@@ -182,10 +202,13 @@ pytz==2024.2
182202
# commercetools
183203
pyyaml==6.0.2
184204
# via edx-django-release-util
185-
redis==5.2.0
205+
redis==5.2.1
186206
# via celery
187207
requests==2.32.3
188208
# via
209+
# apimatic-core
210+
# apimatic-requests-client-adapter
211+
# cachecontrol
189212
# commercetools
190213
# coreapi
191214
# edx-drf-extensions
@@ -207,7 +230,7 @@ semantic-version==2.10.0
207230
# via edx-drf-extensions
208231
simplejson==3.19.3
209232
# via django-rest-swagger
210-
six==1.16.0
233+
six==1.17.0
211234
# via
212235
# edx-auth-backends
213236
# edx-django-release-util
@@ -218,13 +241,13 @@ social-auth-core==4.5.4
218241
# via
219242
# edx-auth-backends
220243
# social-auth-app-django
221-
sqlparse==0.5.1
244+
sqlparse==0.5.3
222245
# via django
223-
stevedore==5.3.0
246+
stevedore==5.4.0
224247
# via
225248
# edx-django-utils
226249
# edx-opaque-keys
227-
stripe==11.2.0
250+
stripe==11.3.0
228251
# via -r requirements/base.in
229252
typing-extensions==4.12.2
230253
# via
@@ -247,7 +270,10 @@ wcwidth==0.2.13
247270
# via prompt-toolkit
248271
webob==1.8.9
249272
# via commercetools
250-
werkzeug==3.0.6
273+
werkzeug==3.1.3
251274
# via commercetools
252-
wrapt==1.16.0
275+
wrapt==1.17.0
253276
# via commercetools
277+
278+
# The following packages are considered to be unsafe in a requirements file:
279+
# setuptools

requirements/ci.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ filelock==3.16.1
1616
# via
1717
# tox
1818
# virtualenv
19-
packaging==24.1
19+
packaging==24.2
2020
# via
2121
# pyproject-api
2222
# tox
@@ -30,5 +30,5 @@ pyproject-api==1.8.0
3030
# via tox
3131
tox==4.23.2
3232
# via -r requirements/ci.in
33-
virtualenv==20.27.1
33+
virtualenv==20.28.0
3434
# via tox

requirements/common_constraints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55

6+
67
# A central location for most common version constraints
78
# (across edx repos) for pip-installation.
89
#

0 commit comments

Comments
 (0)