Skip to content

Commit

Permalink
fix: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mubbsharanwar committed Dec 18, 2024
1 parent 68da628 commit 60c376b
Show file tree
Hide file tree
Showing 17 changed files with 490 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def get_edx_refund_info(payment: CTPayment) -> decimal:
refund_amount = decimal.Decimal(0.00)
interaction_id = None
for transaction in payment.transactions:

if transaction.type == TransactionType.CHARGE: # pragma no cover
refund_amount += decimal.Decimal(typed_money_to_string(transaction.amount, money_as_decimal_string=True))
interaction_id = transaction.interaction_id
Expand Down
4 changes: 2 additions & 2 deletions commerce_coordinator/apps/commercetools/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def run_filter(self, active_order_management_system, order_number, **kwargs): #
ret_val = {
"order_data": ct_order,
"psp": psp,
"payment_intent_id": payment.interface_id
"payment_intent_id": payment.interface_id if payment else None
}

return ret_val
Expand Down Expand Up @@ -298,12 +298,12 @@ class CreateReturnPaymentTransaction(PipelineStep):

def run_filter(
self,
refund_response,
active_order_management_system,
payment_data,
has_been_refunded,
payment_intent_id,
psp,
refund_response=None,
**kwargs
): # pylint: disable=arguments-differ
"""
Expand Down
1 change: 1 addition & 0 deletions commerce_coordinator/apps/commercetools/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from commercetools.platform.models import Transaction as CTTransaction
from commercetools.platform.models import TransactionState, TransactionType
from commercetools.platform.models import TypeReference as CTTypeReference
from commercetools.platform.models import TypedMoney as CTTypedMoney
from commercetools.platform.models.state import State as CTLineItemState
from commercetools.platform.models.state import StateTypeEnum as CTStateType
from commercetools.testing import BackendRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,14 @@ def get_uut():
# todo this flow is broken
@patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order')
@patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient')
def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal):
@patch.object(CommercetoolsAPIClientMock, 'payment_mock', new_callable=MagicMock)
def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal, custom_payment_mock):
"""
Check calling uut with mock_parameters yields call to client with
expected_data.
"""
mock_values = self.mock
custom_payment_mock.return_value = CTPaymentByKey()

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

Expand Down
1 change: 0 additions & 1 deletion commerce_coordinator/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from commerce_coordinator.apps.titan import urls as titan_urls
from commerce_coordinator.settings.base import FAVICON_URL


admin.autodiscover()

urlpatterns = oauth2_urlpatterns + [
Expand Down
66 changes: 46 additions & 20 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@
#
# make upgrade
#
amqp==5.2.0
amqp==5.3.1
# via kombu
apimatic-core==0.2.17
# via paypal-server-sdk
apimatic-core-interfaces==0.1.5
# via
# apimatic-core
# apimatic-requests-client-adapter
# paypal-server-sdk
apimatic-requests-client-adapter==0.1.6
# via paypal-server-sdk
asgiref==3.7.2
# via
# -r requirements/base.in
# django
# django-cors-headers
attrs==24.2.0
attrs==24.3.0
# via -r requirements/base.in
backoff==2.2.1
# via segment-analytics-python
billiard==4.2.1
# via celery
cachecontrol==0.12.14
# via apimatic-requests-client-adapter
celery[redis]==5.4.0
# via -r requirements/base.in
certifi==2024.8.30
certifi==2024.12.14
# via requests
cffi==1.17.1
# via
Expand Down Expand Up @@ -48,7 +59,7 @@ coreapi==2.3.3
# openapi-codec
coreschema==0.0.4
# via coreapi
cryptography==43.0.3
cryptography==44.0.0
# via
# pyjwt
# social-auth-core
Expand All @@ -58,7 +69,7 @@ defusedxml==0.8.0rc2
# via
# python3-openid
# social-auth-core
django==4.2.16
django==4.2.17
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
Expand All @@ -83,7 +94,7 @@ django-extensions==3.2.3
# via -r requirements/base.in
django-rest-swagger==2.2.0
# via -r requirements/base.in
django-waffle==4.1.0
django-waffle==4.2.0
# via
# -r requirements/base.in
# edx-django-utils
Expand All @@ -104,7 +115,7 @@ edx-braze-client==0.2.5
# via -r requirements/base.in
edx-django-release-util==1.4.0
# via -r requirements/base.in
edx-django-utils==7.0.0
edx-django-utils==7.1.0
# via
# -r requirements/base.in
# edx-drf-extensions
Expand All @@ -121,32 +132,40 @@ itypes==1.2.0
# via coreapi
jinja2==3.1.4
# via coreschema
jsonpickle==3.3.0
# via apimatic-core
jsonpointer==2.4
# via apimatic-core
kombu==5.4.2
# via celery
markupsafe==3.0.2
# via
# jinja2
# werkzeug
marshmallow==3.23.0
marshmallow==3.23.1
# via
# commercetools
# marshmallow-enum
marshmallow-enum==1.5.1
# via commercetools
mysqlclient==2.2.5
msgpack==1.1.0
# via cachecontrol
mysqlclient==2.2.6
# via -r requirements/base.in
newrelic==10.2.0
newrelic==10.4.0
# via edx-django-utils
oauthlib==3.2.2
# via
# requests-oauthlib
# social-auth-core
openapi-codec==1.3.2
# via django-rest-swagger
openedx-filters==1.11.0
openedx-filters==1.12.0
# via -r requirements/base.in
packaging==24.1
packaging==24.2
# via marshmallow
paypal-server-sdk==0.5.1
# via -r requirements/base.in
pbr==6.1.0
# via stevedore
pillow==11.0.0
Expand All @@ -157,7 +176,7 @@ psutil==6.1.0
# via edx-django-utils
pycparser==2.22
# via cffi
pyjwt[crypto]==2.9.0
pyjwt[crypto]==2.10.1
# via
# drf-jwt
# edx-auth-backends
Expand All @@ -172,6 +191,7 @@ pynacl==1.5.0
python-dateutil==2.9.0.post0
# via
# -r requirements/base.in
# apimatic-core
# celery
# segment-analytics-python
python3-openid==3.2.0
Expand All @@ -182,10 +202,13 @@ pytz==2024.2
# commercetools
pyyaml==6.0.2
# via edx-django-release-util
redis==5.2.0
redis==5.2.1
# via celery
requests==2.32.3
# via
# apimatic-core
# apimatic-requests-client-adapter
# cachecontrol
# commercetools
# coreapi
# edx-drf-extensions
Expand All @@ -207,7 +230,7 @@ semantic-version==2.10.0
# via edx-drf-extensions
simplejson==3.19.3
# via django-rest-swagger
six==1.16.0
six==1.17.0
# via
# edx-auth-backends
# edx-django-release-util
Expand All @@ -218,13 +241,13 @@ social-auth-core==4.5.4
# via
# edx-auth-backends
# social-auth-app-django
sqlparse==0.5.1
sqlparse==0.5.3
# via django
stevedore==5.3.0
stevedore==5.4.0
# via
# edx-django-utils
# edx-opaque-keys
stripe==11.2.0
stripe==11.3.0
# via -r requirements/base.in
typing-extensions==4.12.2
# via
Expand All @@ -247,7 +270,10 @@ wcwidth==0.2.13
# via prompt-toolkit
webob==1.8.9
# via commercetools
werkzeug==3.0.6
werkzeug==3.1.3
# via commercetools
wrapt==1.16.0
wrapt==1.17.0
# via commercetools

# The following packages are considered to be unsafe in a requirements file:
# setuptools
4 changes: 2 additions & 2 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ filelock==3.16.1
# via
# tox
# virtualenv
packaging==24.1
packaging==24.2
# via
# pyproject-api
# tox
Expand All @@ -30,5 +30,5 @@ pyproject-api==1.8.0
# via tox
tox==4.23.2
# via -r requirements/ci.in
virtualenv==20.27.1
virtualenv==20.28.0
# via tox
1 change: 1 addition & 0 deletions requirements/common_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@




# A central location for most common version constraints
# (across edx repos) for pip-installation.
#
Expand Down
Loading

0 comments on commit 60c376b

Please sign in to comment.