diff --git a/Pipfile.lock b/Pipfile.lock index cb6a2d688..0387d0fa0 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -363,11 +363,11 @@ "django" ], "hashes": [ - "sha256:11d1db362ff6bfa54f7fb188942fddee6233ef2892c843241fb49bfeaf01b578", - "sha256:870da932189a2377dc119f33ab06f48b8690e32800575e1b1f23e841e9dd71d8" + "sha256:6a153da3005c8044e8550d45791ad6e5a2b56471db4b660deb215a140c97c999", + "sha256:bc24475f625bc0ddcd2d3ba115742353aada611710d63c8436ff4b5351cd8470" ], "markers": "python_version >= '3.11'", - "version": "==1.7.0" + "version": "==1.8.0" }, "certifi": { "hashes": [ @@ -1313,7 +1313,7 @@ "sha256:fd096eb7ffef17c456cfa587523c5f92321ae02427ff955bebe9e3c63bc9f0da", "sha256:fe754d231288e1e64323cfad462fcee8f0288654c10bdf4f603a39ed923bef33" ], - "markers": "python_version >= '3' and platform_machine == 'aarch64' or (platform_machine == 'ppc64le' or (platform_machine == 'x86_64' or (platform_machine == 'amd64' or (platform_machine == 'AMD64' or (platform_machine == 'win32' or platform_machine == 'WIN32')))))", + "markers": "python_version >= '3.7'", "version": "==3.0.3" }, "grpcio": { @@ -2249,12 +2249,12 @@ }, "openai": { "hashes": [ - "sha256:7b26544cef80f125431c073ffab3811d2421fbb9e30d3bd5c2436aba00b042d5", - "sha256:d6177087f150b381d49499be782d764213fdf638d391b29ca692b84dd675a389" + "sha256:28d92503c6e4b6a32a89277b36693023ef41f60922a4b5c8c621e8c5697ae3a6", + "sha256:67ef289ae22d350cbf9381d83ae82c4e3596d71b7ad1cc886143554ee12fe0c9" ], "index": "pypi", "markers": "python_full_version >= '3.7.1'", - "version": "==1.35.3" + "version": "==1.35.5" }, "packaging": { "hashes": [ @@ -2393,12 +2393,12 @@ }, "pip": { "hashes": [ - "sha256:a775837439bf5da2c1a0c2fa43d5744854497c689ddbd9344cf3ea6d00598540", - "sha256:bdae551038c0ce6a83030b4aedef27fc95f0daa683593fea22fa05e55ed8e317" + "sha256:5aa64f65e1952733ee0a9a9b1f52496ebdb3f3077cc46f80a16d983b58d1180a", + "sha256:efca15145a95e95c00608afeab66311d40bfb73bb2266a855befd705e6bb15a0" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==24.1" + "version": "==24.1.1" }, "platformdirs": { "hashes": [ @@ -3089,11 +3089,11 @@ "hiredis" ], "hashes": [ - "sha256:38473cd7c6389ad3e44a91f4c3eaf6bcb8a9f746007f29bf4fb20824ff0b2197", - "sha256:c0d6d990850c627bbf7be01c5c4cbaadf67b48593e913bb71c9819c30df37eee" + "sha256:0e479e24da960c690be5d9b96d21f7b918a98c0cf49af3b6fafaa0753f93a0db", + "sha256:8f611490b93c8109b50adc317b31bfd84fff31def3475b92e7e80bf39f48175b" ], "markers": "python_version >= '3.7'", - "version": "==5.0.6" + "version": "==5.0.7" }, "referencing": { "hashes": [ @@ -3466,7 +3466,7 @@ "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8" ], - "markers": "python_version >= '3.8'", + "markers": "python_version >= '3.7'", "version": "==4.12.2" }, "tzdata": { @@ -3715,15 +3715,7 @@ "markers": "python_version >= '3.7'", "version": "==1.9.4" }, - "zope.event": { - "hashes": [ - "sha256:2832e95014f4db26c47a13fdaef84cef2f4df37e66b59d8f1f4a8f319a632c26", - "sha256:bac440d8d9891b4068e2b5a2c5e2c9765a9df762944bda6955f96bb9b91e67cd" - ], - "markers": "python_version >= '3.7'", - "version": "==5.0" - }, - "zope.interface": { + "zope-interface": { "hashes": [ "sha256:00b5c3e9744dcdc9e84c24ed6646d5cf0cf66551347b310b3ffd70f056535854", "sha256:0e4fa5d34d7973e6b0efa46fe4405090f3b406f64b6290facbb19dcbf642ad6b", @@ -3765,6 +3757,14 @@ "markers": "python_version >= '3.7'", "version": "==6.4.post2" }, + "zope.event": { + "hashes": [ + "sha256:2832e95014f4db26c47a13fdaef84cef2f4df37e66b59d8f1f4a8f319a632c26", + "sha256:bac440d8d9891b4068e2b5a2c5e2c9765a9df762944bda6955f96bb9b91e67cd" + ], + "markers": "python_version >= '3.7'", + "version": "==5.0" + }, "zstandard": { "hashes": [ "sha256:11f0d1aab9516a497137b41e3d3ed4bbf7b2ee2abc79e5c8b010ad286d7464bd", @@ -4270,7 +4270,7 @@ "sha256:fd096eb7ffef17c456cfa587523c5f92321ae02427ff955bebe9e3c63bc9f0da", "sha256:fe754d231288e1e64323cfad462fcee8f0288654c10bdf4f603a39ed923bef33" ], - "markers": "python_version >= '3' and platform_machine == 'aarch64' or (platform_machine == 'ppc64le' or (platform_machine == 'x86_64' or (platform_machine == 'amd64' or (platform_machine == 'AMD64' or (platform_machine == 'win32' or platform_machine == 'WIN32')))))", + "markers": "python_version >= '3.7'", "version": "==3.0.3" }, "griffe": { diff --git a/breathecode/admissions/signals.py b/breathecode/admissions/signals.py index 81db2de24..ae6660cc2 100644 --- a/breathecode/admissions/signals.py +++ b/breathecode/admissions/signals.py @@ -1,17 +1,19 @@ -from django.dispatch import Signal +from task_manager.django.dispatch import Emisor + +emisor = Emisor('breathecode.admissions') # add your receives here -student_edu_status_updated = Signal() -cohort_saved = Signal() -cohort_log_saved = Signal() -cohort_user_created = Signal() -cohort_stage_updated = Signal() +student_edu_status_updated = emisor.signal('student_edu_status_updated') +cohort_saved = emisor.signal('cohort_saved') +cohort_log_saved = emisor.signal('cohort_log_saved') +cohort_user_created = emisor.signal('cohort_user_created') +cohort_stage_updated = emisor.signal('cohort_stage_updated') -academy_saved = Signal() +academy_saved = emisor.signal('academy_saved') # happens when any asset gets update inside the syllabus json for any version -syllabus_asset_slug_updated = Signal() +syllabus_asset_slug_updated = emisor.signal('syllabus_asset_slug_updated') -syllabus_version_json_updated = Signal() +syllabus_version_json_updated = emisor.signal('syllabus_version_json_updated') -timeslot_saved = Signal() +timeslot_saved = emisor.signal('timeslot_saved') diff --git a/breathecode/authenticate/tests/management/commands/tests_set_permissions.py b/breathecode/authenticate/tests/management/commands/tests_set_permissions.py index 3fd412299..c2ffe8ed6 100644 --- a/breathecode/authenticate/tests/management/commands/tests_set_permissions.py +++ b/breathecode/authenticate/tests/management/commands/tests_set_permissions.py @@ -71,8 +71,8 @@ def setUp(self): # the behavior of permissions is not exact, this changes every time you add a model self.latest_content_type_id = content_type.id self.latest_permission_id = permission.id - self.job_content_type_id = self.latest_content_type_id - 59 - self.can_delete_job_permission_id = self.latest_permission_id - 237 + self.job_content_type_id = self.latest_content_type_id - 61 + self.can_delete_job_permission_id = self.latest_permission_id - 245 """ 🔽🔽🔽 format of PERMISSIONS diff --git a/breathecode/certificate/signals.py b/breathecode/certificate/signals.py index afc81a863..225d2e510 100644 --- a/breathecode/certificate/signals.py +++ b/breathecode/certificate/signals.py @@ -1,7 +1,7 @@ -""" -For each signal you want other apps to be able to receive, you have to -declare a new variable here like this: -""" -from django.dispatch import Signal +"""For each signal you want other apps to be able to receive, you have to declare a new variable here like this.""" -user_specialty_saved = Signal() +from task_manager.django.dispatch import Emisor + +emisor = Emisor('breathecode.certificate') + +user_specialty_saved = emisor.signal('user_specialty_saved') diff --git a/breathecode/commons/signals.py b/breathecode/commons/signals.py index ad15c92a8..ed184bdf6 100644 --- a/breathecode/commons/signals.py +++ b/breathecode/commons/signals.py @@ -1,7 +1,7 @@ -""" -For each signal you want other apps to be able to receive, you have to -declare a new variable here like this: -""" -from django.dispatch import Signal +"""For each signal you want other apps to be able to receive, you have to declare a new variable here like this.""" -update_cache = Signal() +from task_manager.django.dispatch import Emisor + +emisor = Emisor('breathecode.commons') + +update_cache = emisor.signal('update_cache') diff --git a/breathecode/events/signals.py b/breathecode/events/signals.py index 7882bad85..c54c326c3 100644 --- a/breathecode/events/signals.py +++ b/breathecode/events/signals.py @@ -1,10 +1,10 @@ -""" -For each signal you want other apps to be able to receive, you have to -declare a new variable here like this: -""" -from django.dispatch import Signal +"""For each signal you want other apps to be able to receive, you have to declare a new variable here like this.""" -event_saved = Signal() -event_status_updated = Signal() -new_event_attendee = Signal() -new_event_order = Signal() +from task_manager.django.dispatch import Emisor + +emisor = Emisor('breathecode.events') + +event_saved = emisor.signal('event_saved') +event_status_updated = emisor.signal('event_status_updated') +new_event_attendee = emisor.signal('new_event_attendee') +new_event_order = emisor.signal('new_event_order') diff --git a/breathecode/events/views.py b/breathecode/events/views.py index ca42c23f4..4924fc433 100644 --- a/breathecode/events/views.py +++ b/breathecode/events/views.py @@ -35,7 +35,7 @@ response_207, ) from breathecode.utils.api_view_extensions.api_view_extensions import APIViewExtensions -from breathecode.utils.decorators import consume, has_permission +from breathecode.utils.decorators import consume from breathecode.utils.i18n import translation from breathecode.utils.multi_status_response import MultiStatusResponse from breathecode.utils.views import private_view, render_message diff --git a/breathecode/marketing/signals.py b/breathecode/marketing/signals.py index 6d8663c5a..d5a1b653f 100644 --- a/breathecode/marketing/signals.py +++ b/breathecode/marketing/signals.py @@ -1,10 +1,10 @@ -""" -For each signal you want other apps to be able to receive, you have to -declare a new variable here like this: -""" -from django.dispatch import Signal +"""For each signal you want other apps to be able to receive, you have to declare a new variable here like this.""" -downloadable_saved = Signal() +from task_manager.django.dispatch import Emisor -form_entry_won_or_lost = Signal() -new_form_entry_deal = Signal() +emisor = Emisor('breathecode.marketing') + +downloadable_saved = emisor.signal('downloadable_saved') + +form_entry_won_or_lost = emisor.signal('form_entry_won_or_lost') +new_form_entry_deal = emisor.signal('new_form_entry_deal') diff --git a/breathecode/payments/management/commands/make_charges.py b/breathecode/payments/management/commands/make_charges.py index 86e769796..933a6dd70 100644 --- a/breathecode/payments/management/commands/make_charges.py +++ b/breathecode/payments/management/commands/make_charges.py @@ -15,7 +15,7 @@ class Command(BaseCommand): def handle(self, *args, **options): utc_now = timezone.now() - statuses = ['CANCELLED', 'DEPRECATED', 'FREE_TRIAL'] + statuses = ['CANCELLED', 'DEPRECATED', 'FREE_TRIAL', 'EXPIRED'] avoid_expire_these_statuses = Q(status='EXPIRED') | Q(status='ERROR') | Q(status='PAYMENT_ISSUE') | Q( status='FULLY_PAID') | Q(status='FREE_TRIAL') | Q(status='CANCELLED') | Q(status='DEPRECATED') @@ -26,6 +26,10 @@ def handle(self, *args, **options): 'next_payment_at__lte': utc_now + timedelta(days=1), } + Subscription.objects.filter(Q(valid_until__gte=utc_now) | Q(valid_until__isnull=True), + next_payment_at__lte=utc_now - timedelta(days=7), + status='PAYMENT_ISSUE').update(status='EXPIRED') + Subscription.objects.filter(valid_until__lte=utc_now).exclude(avoid_expire_these_statuses).update( status='EXPIRED') diff --git a/breathecode/payments/signals.py b/breathecode/payments/signals.py index 66e047df5..b93e27c60 100644 --- a/breathecode/payments/signals.py +++ b/breathecode/payments/signals.py @@ -1,23 +1,23 @@ -""" -For each signal you want other apps to be able to receive, you have to -declare a new variable here like this: -""" -from django.dispatch import Signal +"""For each signal you want other apps to be able to receive, you have to declare a new variable here like this.""" + +from task_manager.django.dispatch import Emisor + +emisor = Emisor('breathecode.payments') # consume a service -consume_service = Signal() +consume_service = emisor.signal('consume_service') # refund the units in case of error -reimburse_service_units = Signal() +reimburse_service_units = emisor.signal('reimburse_service_units') # manage of permissions for the service -lose_service_permissions = Signal() -grant_service_permissions = Signal() -revoke_service_permissions = Signal() +lose_service_permissions = emisor.signal('lose_service_permissions') +grant_service_permissions = emisor.signal('grant_service_permissions') +revoke_service_permissions = emisor.signal('revoke_service_permissions') # proxy to m2m_changed in Event.service_items -update_plan_m2m_service_items = Signal() +update_plan_m2m_service_items = emisor.signal('update_plan_m2m_service_items') -# Plan aquired -planfinancing_created = Signal() -subscription_created = Signal() +# Plan adquired +planfinancing_created = emisor.signal('planfinancing_created') +subscription_created = emisor.signal('subscription_created') diff --git a/breathecode/payments/tests/management/commands/tests_make_charges.py b/breathecode/payments/tests/management/commands/tests_make_charges.py index 4650e2efa..d93fdd307 100644 --- a/breathecode/payments/tests/management/commands/tests_make_charges.py +++ b/breathecode/payments/tests/management/commands/tests_make_charges.py @@ -73,6 +73,66 @@ def test_with_two_subscriptions__expired(bc: Breathecode, delta, status, status_ assert tasks.charge_subscription.delay.call_args_list == [] +@pytest.mark.parametrize('delta_valid_until, delta_next_payment_at', [ + (relativedelta(0), -relativedelta(days=7, seconds=1)), + (relativedelta(days=28), -relativedelta(days=7, seconds=1)), +]) +def test_with_two_subscriptions__payment_issue__gt_7_days(bc: Breathecode, delta_valid_until, delta_next_payment_at, + utc_now): + + if delta_valid_until: + valid_until = utc_now + delta_valid_until + + else: + valid_until = None + + next_payment_at = utc_now + delta_next_payment_at + + subscription = {'valid_until': valid_until, 'next_payment_at': next_payment_at, 'status': 'PAYMENT_ISSUE'} + + model = bc.database.create(subscription=(2, subscription)) + + command = Command() + result = command.handle() + + assert result == None + db = bc.format.to_dict(model.subscription) + for i in range(len(db)): + db[i]['status'] = 'EXPIRED' + + assert bc.database.list_of('payments.Subscription') == db + assert tasks.charge_subscription.delay.call_args_list == [] + + +@pytest.mark.parametrize('delta_valid_until, delta_next_payment_at', [ + (relativedelta(0), -relativedelta(days=6)), + (relativedelta(days=28), -relativedelta(days=6)), +]) +def test_with_two_subscriptions__payment_issue__lt_7_days(bc: Breathecode, delta_valid_until, delta_next_payment_at, + utc_now): + + if delta_valid_until: + valid_until = utc_now + delta_valid_until + + else: + valid_until = None + + next_payment_at = utc_now + delta_next_payment_at + + subscription = {'valid_until': valid_until, 'next_payment_at': next_payment_at, 'status': 'PAYMENT_ISSUE'} + + model = bc.database.create(subscription=(2, subscription)) + + command = Command() + result = command.handle() + + assert result == None + db = bc.format.to_dict(model.subscription) + + assert bc.database.list_of('payments.Subscription') == db + assert tasks.charge_subscription.delay.call_args_list == [call(1), call(2)] + + @pytest.mark.parametrize('delta, status', [ (relativedelta(days=2, seconds=1), 'ACTIVE'), (relativedelta(days=2, seconds=1), 'ERROR'), diff --git a/breathecode/provisioning/signals.py b/breathecode/provisioning/signals.py index 908e2aedc..e98c366ed 100644 --- a/breathecode/provisioning/signals.py +++ b/breathecode/provisioning/signals.py @@ -1,7 +1,7 @@ -""" -For each signal you want other apps to be able to receive, you have to -declare a new variable here like this: -""" -from django.dispatch import Signal +"""For each signal you want other apps to be able to receive, you have to declare a new variable here like this.""" -process_stripe_event = Signal() +from task_manager.django.dispatch import Emisor + +emisor = Emisor('breathecode.provisioning') + +process_stripe_event = emisor.signal('process_stripe_event') diff --git a/breathecode/registry/views.py b/breathecode/registry/views.py index f4ce94453..c0b5d76d4 100644 --- a/breathecode/registry/views.py +++ b/breathecode/registry/views.py @@ -24,7 +24,6 @@ from breathecode.services.seo import SEOAnalyzer from breathecode.utils import GenerateLookupsMixin, capable_of, consume from breathecode.utils.api_view_extensions.api_view_extensions import APIViewExtensions -from breathecode.utils.decorators.has_permission import has_permission from breathecode.utils.i18n import translation from breathecode.utils.views import render_message from capyc.rest_framework.exceptions import ValidationException diff --git a/breathecode/utils/decorators/consume.py b/breathecode/utils/decorators/consume.py index 5f0fb2f64..4429c231d 100644 --- a/breathecode/utils/decorators/consume.py +++ b/breathecode/utils/decorators/consume.py @@ -258,7 +258,7 @@ def wrapper(*args, **kwargs): elif it_will_consume: item = context['consumables'].first() - consume_service.send(instance=item, sender=item.__class__, how_many=context['price']) + consume_service.send_robust(instance=item, sender=item.__class__, how_many=context['price']) return response @@ -369,7 +369,7 @@ async def async_wrapper(*args, **kwargs): elif it_will_consume: item = await context['consumables'].afirst() - consume_service.send(instance=item, sender=item.__class__, how_many=context['price']) + consume_service.send_robust(instance=item, sender=item.__class__, how_many=context['price']) return response diff --git a/breathecode/utils/decorators/has_permission.py b/breathecode/utils/decorators/has_permission.py index d35ead2fe..b5aad7008 100644 --- a/breathecode/utils/decorators/has_permission.py +++ b/breathecode/utils/decorators/has_permission.py @@ -1,7 +1,6 @@ import asyncio import logging import traceback -from contextlib import asynccontextmanager, contextmanager from typing import Any, Optional from adrf.requests import AsyncRequest diff --git a/breathecode/utils/tests/decorators/tests_consume.py b/breathecode/utils/tests/decorators/tests_consume.py index e45e1c8d4..8785881a0 100644 --- a/breathecode/utils/tests/decorators/tests_consume.py +++ b/breathecode/utils/tests/decorators/tests_consume.py @@ -30,7 +30,7 @@ @pytest.fixture(autouse=True) def setup(db, monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr('django.utils.timezone.now', MagicMock(return_value=UTC_NOW)) - monkeypatch.setattr('breathecode.payments.signals.consume_service.send', MagicMock(return_value=None)) + monkeypatch.setattr('breathecode.payments.signals.consume_service.send_robust', MagicMock(return_value=None)) monkeypatch.setattr('breathecode.payments.models.ConsumptionSession.build_session', MagicMock(wraps=models.ConsumptionSession.build_session)) @@ -283,7 +283,7 @@ async def test_anonymous_user(self, database: capy.Database, make_view_all_cases @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -304,7 +304,7 @@ async def test_with_user(self, database: capy.Database, make_view_all_cases): @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -325,7 +325,7 @@ async def test_with_user__with_permission__dont_match(self, database: capy.Datab @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -350,7 +350,7 @@ async def test_with_user__with_group_related_to_permission__without_consumable(s @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -379,7 +379,7 @@ async def test_with_user__with_group_related_to_permission__consumable__how_many @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [ + assert payments_signals.consume_service.send_robust.call_args_list == [ call(instance=model.consumable, sender=model.consumable.__class__, how_many=1), ] @@ -411,7 +411,7 @@ async def test_with_user__with_group_related_to_permission__consumable__how_many @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -440,7 +440,7 @@ async def test_with_user__with_group_related_to_permission__consumable__how_many @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [ + assert payments_signals.consume_service.send_robust.call_args_list == [ call(instance=model.consumable, sender=model.consumable.__class__, how_many=1), ] @@ -472,7 +472,7 @@ async def test_with_user__with_group_related_to_permission__group_was_blackliste @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [ + assert payments_signals.consume_service.send_robust.call_args_list == [ call(instance=model.consumable, sender=model.consumable.__class__, how_many=1), ] @@ -497,7 +497,7 @@ async def test__function__get__anonymous_user(self, bc: Breathecode, make_view_c @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -518,7 +518,7 @@ async def test__function__get__with_user(self, bc: Breathecode, make_view_consum @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -540,7 +540,7 @@ async def test__function__get__with_user__with_permission__dont_match(self, bc: @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -590,7 +590,7 @@ async def test__function__get__with_user__with_group_related_to_permission__with @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -646,7 +646,7 @@ async def test__function__get__with_user__with_group_related_to_permission__cons @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [ + assert payments_signals.consume_service.send_robust.call_args_list == [ call(instance=model.consumable, sender=model.consumable.__class__, how_many=1), ] @@ -705,7 +705,7 @@ async def test__function__get__with_user__with_group_related_to_permission__cons @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -761,7 +761,7 @@ async def test__function__get__with_user__with_group_related_to_permission__cons @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [ + assert payments_signals.consume_service.send_robust.call_args_list == [ call(instance=model.consumable, sender=model.consumable.__class__, how_many=1), ] @@ -821,7 +821,7 @@ async def test__function__get__with_user__with_group_related_to_permission__grou @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -879,7 +879,7 @@ async def test__function__get__with_user__without_consumption_session(self, bc: @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [ + assert payments_signals.consume_service.send_robust.call_args_list == [ call(instance=model.consumable, sender=model.consumable.__class__, how_many=1), ] @@ -945,7 +945,7 @@ async def test__with_user__consumption_session__does_not_match(self, bc: Breathe @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [ + assert payments_signals.consume_service.send_robust.call_args_list == [ call(instance=model.consumable, sender=model.consumable.__class__, how_many=1), ] @@ -1001,7 +1001,7 @@ async def test__with_user__consumption_session__does_not_match__consumables_minu @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() @@ -1054,6 +1054,6 @@ async def test__with_user__consumption_session__match(self, bc: Breathecode, mak @sync_to_async def check_consume_service(): - assert payments_signals.consume_service.send.call_args_list == [] + assert payments_signals.consume_service.send_robust.call_args_list == [] await check_consume_service() diff --git a/breathecode/utils/validate_conversion_info.py b/breathecode/utils/validate_conversion_info.py index 42f4f8d98..5ffef7120 100644 --- a/breathecode/utils/validate_conversion_info.py +++ b/breathecode/utils/validate_conversion_info.py @@ -1,5 +1,5 @@ from breathecode.utils.i18n import translation -from capyc.rest_framework.exceptions import PaymentException, ValidationException +from capyc.rest_framework.exceptions import ValidationException __all__ = ['validate_conversion_info']