Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jefer94 committed Jun 21, 2024
1 parent 722a5d5 commit 2e3d991
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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') == []
Expand All @@ -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') == []
Expand All @@ -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') == []
Expand All @@ -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') == [
{
Expand All @@ -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)]

Expand Down
7 changes: 0 additions & 7 deletions breathecode/certificate/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Original file line number Diff line number Diff line change
Expand Up @@ -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 == []

Expand All @@ -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 == []

Expand All @@ -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)]

Expand All @@ -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)]

Expand Down Expand Up @@ -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)]

Expand Down Expand Up @@ -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)]

Expand Down Expand Up @@ -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)]

Expand Down Expand Up @@ -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)]

Expand All @@ -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 == []

Expand All @@ -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 == []

Expand Down Expand Up @@ -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 == []

Expand Down Expand Up @@ -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 == []

Expand Down Expand Up @@ -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 == []

Expand Down Expand Up @@ -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 == []

Expand Down
8 changes: 0 additions & 8 deletions capyc/django/pytest/fixtures/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,15 @@ 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:

def apply_mock(module):

def send_mock(*args, **kwargs):
if debug:
print(module)
try:
print(' args\n ', args)
except Exception:
Expand Down

0 comments on commit 2e3d991

Please sign in to comment.