Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
sdemagny committed Dec 26, 2024
1 parent baca4ca commit 02a4f78
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ def test_api_mail_domains__check_broken_domain_changes_status(user, domain):
assert domain.status == enums.MailDomainStatusChoices.ENABLED
response = client.get(f"/api/v1.0/mail-domains/{domain.slug}/check/")
assert response.status_code == status.HTTP_200_OK and response.json()['state'] == "broken"
assert domain.status == enums.MailDomainStatusChoices.FAILED
assert domain.status == enums.MailDomainStatusChoices.FAILED
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,3 @@ def test_dimail_synchronization__synchronize_mailboxes(mock_warning):
mailbox = models.Mailbox.objects.get()
assert mailbox.local_part == "oxadmin"
assert imported_mailboxes == [mailbox_valid["email"]]

5 changes: 2 additions & 3 deletions src/backend/mailbox_manager/utils/dimail.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,11 @@ def check_domain(self, domain):

if response.status_code == status.HTTP_200_OK:
state = response.json()["state"]
import pdb; pdb.set_trace()
if domain.status == enums.MailDomainStatusChoices.PENDING and state == "ok":
if domain.status != enums.MailDomainStatusChoices.ENABLED and state == "ok":
domain.status = enums.MailDomainStatusChoices.ENABLED
domain.save()

if domain.status == enums.MailDomainStatusChoices.ENABLED and state == "broken":
elif domain.status != enums.MailDomainStatusChoices.FAILED and state == "broken":
domain.status = enums.MailDomainStatusChoices.FAILED
domain.save()

Expand Down

0 comments on commit 02a4f78

Please sign in to comment.