Skip to content

Commit

Permalink
fix tests and an undefined variable error
Browse files Browse the repository at this point in the history
  • Loading branch information
jefer94 committed Sep 19, 2024
1 parent 7620a34 commit d821e08
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions breathecode/assignments/tests/urls/tests_user_me_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,10 @@ def test__put__with_task__one_item_in_body__passing_revision_status(self):
@patch("django.db.models.signals.pre_delete.send_robust", MagicMock(return_value=None))
@patch("breathecode.admissions.signals.student_edu_status_updated.send_robust", MagicMock(return_value=None))
def test__put__with_task__one_item_in_body__passing_revision_status__teacher_token(self):
statuses = ["APPROVED", "REJECTED", "IGNORED"]
for index in range(0, 3):
statuses = ["APPROVED", "REJECTED"]
for index in range(0, 2):
current_status = statuses[index]
next_status = statuses[index - 1 if index > 0 else 2]
next_status = statuses[index - 1 if index > 0 else 1]
task = {"revision_status": current_status, "task_status": "DONE"}
cohort_users = [
{
Expand Down
2 changes: 1 addition & 1 deletion breathecode/cypress/tests/urls/tests_load_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def test_load_roles__check_the_capabilities(self):

for capability in CAPABILITIES:
self.assertRegex(capability["slug"], r"^[a-z_]+$")
self.assertRegex(capability["description"], r'^[a-zA-Z,. _()"]+$')
self.assertRegex(capability["description"], r'^[a-zA-Z,. _()"\']+$')
self.assertEqual(len(capability), 2)

def test_load_roles__check_the_roles(self):
Expand Down
8 changes: 6 additions & 2 deletions breathecode/payments/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,13 @@ def alert_payment_issue(message: str, button: str) -> None:
academy=subscription.academy,
)

bag.delete()
if bag:
bag.delete()

subscription.status = "PAYMENT_ISSUE"
subscription.save()

bag = None
client = None
if IS_DJANGO_REDIS:
client = get_redis_connection("default")
Expand Down Expand Up @@ -462,11 +464,13 @@ def alert_payment_issue(message: str, button: str) -> None:
academy=plan_financing.academy,
)

bag.delete()
if bag:
bag.delete()

plan_financing.status = "PAYMENT_ISSUE"
plan_financing.save()

bag = None
client = None
if IS_DJANGO_REDIS:
client = get_redis_connection("default")
Expand Down

0 comments on commit d821e08

Please sign in to comment.