diff --git a/breathecode/authenticate/tests/tasks/tests_create_user_from_invite.py b/breathecode/authenticate/tests/tasks/tests_create_user_from_invite.py index a75c4e430..fe46f55e8 100644 --- a/breathecode/authenticate/tests/tasks/tests_create_user_from_invite.py +++ b/breathecode/authenticate/tests/tasks/tests_create_user_from_invite.py @@ -39,7 +39,7 @@ def user_serializer(data={}): def test_no_invites(bc: Breathecode): - create_user_from_invite(1) + create_user_from_invite.delay(1) assert bc.database.list_of('authenticate.UserInvite') == [] assert bc.database.list_of('auth.User') == [] @@ -51,7 +51,7 @@ def test_no_invites(bc: Breathecode): def test_invite_not_accepted(bc: Breathecode, status): model = bc.database.create(user_invite={'status': status}) - create_user_from_invite(1) + create_user_from_invite.delay(1) assert bc.database.list_of('authenticate.UserInvite') == [bc.format.to_dict(model.user_invite)] assert bc.database.list_of('auth.User') == [] @@ -62,7 +62,7 @@ def test_invite_not_accepted(bc: Breathecode, status): def test_no_email(bc: Breathecode): model = bc.database.create(user_invite={'status': 'ACCEPTED'}) - create_user_from_invite(1) + create_user_from_invite.delay(1) assert bc.database.list_of('authenticate.UserInvite') == [bc.format.to_dict(model.user_invite)] assert bc.database.list_of('auth.User') == [] @@ -80,7 +80,7 @@ def test_user_exists(bc: Breathecode, fake, is_linked_the_user): model = bc.database.create(user_invite=user_invite, user=user) - create_user_from_invite(1) + create_user_from_invite.delay(1) assert bc.database.list_of('authenticate.UserInvite') == [ { @@ -99,7 +99,7 @@ def test_invite_accepted(bc: Breathecode, fake): model = bc.database.create(user_invite=user_invite) - create_user_from_invite(1) + create_user_from_invite.delay(1) assert bc.database.list_of('authenticate.UserInvite') == [bc.format.to_dict(model.user_invite)] diff --git a/breathecode/certificate/models.py b/breathecode/certificate/models.py index 71e1a879f..7f0688b35 100644 --- a/breathecode/certificate/models.py +++ b/breathecode/certificate/models.py @@ -157,14 +157,7 @@ def save(self, *args, **kwargs): hash = self.generate_update_hash() self._hash_was_updated = self.update_hash != hash self.update_hash = hash - print(1, self._hash_was_updated) super().save(*args, **kwargs) # Call the "real" save() method. - print(21, signals.user_specialty_saved.send) - print(22, signals.user_specialty_saved.send.__class__) - print(22, signals.user_specialty_saved.send.__module__) - print(3, signals.user_specialty_saved.send_robust) - print(32, signals.user_specialty_saved.send_robust.__class__) - print(32, signals.user_specialty_saved.send_robust.__module__) signals.user_specialty_saved.send_robust(instance=self, sender=self.__class__) diff --git a/breathecode/certificate/tests/signals/tests_user_specialty_saved.py b/breathecode/certificate/tests/signals/tests_user_specialty_saved.py index c61fe2772..752c5b87c 100644 --- a/breathecode/certificate/tests/signals/tests_user_specialty_saved.py +++ b/breathecode/certificate/tests/signals/tests_user_specialty_saved.py @@ -47,9 +47,6 @@ def test_user_specialty_saved__status_error(self, enable_signals): model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [] @@ -70,9 +67,6 @@ def test_user_specialty_saved__status_pending(self, enable_signals): model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [] @@ -93,9 +87,6 @@ def test_user_specialty_saved__status_persisted__preview_url_is_empty(self, enab model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [call(1)] @@ -117,9 +108,6 @@ def test_user_specialty_saved__status_persisted__preview_url_is_empty__changing_ model.user_specialty.signed_by = 'GOD 🤷‍♂️' model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [call(1), call(1)] @@ -148,9 +136,6 @@ def test_user_specialty_saved__status_persisted__preview_url_is_empty__changing_ model.user_specialty.signed_by_role = 'GOD 🤷‍♂️' model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [call(1), call(1)] @@ -179,9 +164,6 @@ def test_user_specialty_saved__status_persisted__preview_url_is_empty__changing_ model1.user_specialty.layout = model2.layout_design model1.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [call(1), call(1)] @@ -210,9 +192,6 @@ def test_user_specialty_saved__status_persisted__preview_url_is_empty__changing_ model.user_specialty.expires_at = utc_now model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [call(1), call(1)] @@ -241,9 +220,6 @@ def test_user_specialty_saved__status_persisted__preview_url_is_empty__changing_ model.user_specialty.issued_at = utc_now model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [] assert tasks.take_screenshot.delay.call_args_list == [call(1), call(1)] @@ -270,9 +246,6 @@ def test_user_specialty_saved__status_persisted__preview_url_set(self, enable_si model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [call(1)] assert tasks.take_screenshot.delay.call_args_list == [] @@ -294,9 +267,6 @@ def test_user_specialty_saved__status_persisted__preview_url_set__changing_signe model.user_specialty.signed_by = 'GOD 🤷‍♂️' model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [call(1), call(1)] assert tasks.take_screenshot.delay.call_args_list == [] @@ -324,9 +294,6 @@ def test_user_specialty_saved__status_persisted__preview_url_set__changing_signe model.user_specialty.signed_by_role = 'GOD 🤷‍♂️' model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [call(1), call(1)] assert tasks.take_screenshot.delay.call_args_list == [] @@ -355,9 +322,6 @@ def test_user_specialty_saved__status_persisted__preview_url_set__changing_layou model1.user_specialty.layout = model2.layout_design model1.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [call(1), call(1)] assert tasks.take_screenshot.delay.call_args_list == [] @@ -386,9 +350,6 @@ def test_user_specialty_saved__status_persisted__preview_url_set__changing_expir model.user_specialty.expires_at = utc_now model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [call(1), call(1)] assert tasks.take_screenshot.delay.call_args_list == [] @@ -417,9 +378,6 @@ def test_user_specialty_saved__status_persisted__preview_url_set__changing_issue model.user_specialty.issued_at = utc_now model.user_specialty.save() - print('tasks.reset_screenshot', tasks.reset_screenshot.delay.call_args_list) - print('tasks.take_screenshot', tasks.take_screenshot.delay.call_args_list) - assert tasks.reset_screenshot.delay.call_args_list == [call(1), call(1)] assert tasks.take_screenshot.delay.call_args_list == [] diff --git a/capyc/django/pytest/fixtures/signals.py b/capyc/django/pytest/fixtures/signals.py index 6fee3df6b..986b8c483 100644 --- a/capyc/django/pytest/fixtures/signals.py +++ b/capyc/django/pytest/fixtures/signals.py @@ -174,15 +174,8 @@ def enable(self, *to_enable, debug=False): self._monkeypatch.setattr('django.db.models.signals.ModelSignal.send_robust', self._original_model_signal_send_robust) - print('1send', self._original_signal_send) - print('1send_robust', self._original_signal_send_robust) - print('2send', self._original_model_signal_send) - print('2send_robust', self._original_model_signal_send_robust) - if to_enable or debug: - print('to_enable', to_enable) to_disable = [x for x in self._signals_map if x not in to_enable] - # print('to_disable', to_disable) for signal in to_disable: @@ -190,7 +183,6 @@ def apply_mock(module): def send_mock(*args, **kwargs): if debug: - print(module) try: print(' args\n ', args) except Exception: