diff --git a/scipost_django/apimail/management/commands/mailgun_send_test_email.py b/scipost_django/apimail/management/commands/mailgun_send_test_email.py index 888eca4823e4a5b3f77f88ec94b933e28ad7c093..d419e9fc3d87286d76038118508f8e84c258eae4 100644 --- a/scipost_django/apimail/management/commands/mailgun_send_test_email.py +++ b/scipost_django/apimail/management/commands/mailgun_send_test_email.py @@ -31,8 +31,7 @@ class Command(BaseCommand): auth=("api", settings.MAILGUN_API_KEY), data=data, ) - print(data) - print(response) + except Domain.MultipleObjectsReturned: raise APIMailError("Multiple domains found in mailgun_send_test_email") except Domain.DoesNotExist: diff --git a/scipost_django/commentaries/tests/test_forms.py b/scipost_django/commentaries/tests/test_forms.py index df1e420cbc970c2f3821ca12e502abc5e72df289..4a6e195dfbacd034c3aa034455fd34eaecf880df 100644 --- a/scipost_django/commentaries/tests/test_forms.py +++ b/scipost_django/commentaries/tests/test_forms.py @@ -245,7 +245,6 @@ class TestRequestArxivPreprintForm(TestCase): **{"arxiv_identifier": random_arxiv_identifier_with_version_number}, } ) - print("form.errors:\n\t%s" % form.errors) self.assertTrue(form.is_valid()) def test_identifier_that_already_has_commentary_page_is_invalid(self): diff --git a/scipost_django/mails/tests/test_files.py b/scipost_django/mails/tests/test_files.py index 704bca0cd4a8519ef634c7d9d76e0717fc7d666a..2a6a4d6866c521fa82363d515897b089589dfcfa 100644 --- a/scipost_django/mails/tests/test_files.py +++ b/scipost_django/mails/tests/test_files.py @@ -34,4 +34,3 @@ class MailLogFilesTests(TestCase): except Exception as e: self.fail('Mail ("{}") configuration invalid:\n{}'.format(mail_code, e)) i += 1 - print("Tested {} files".format(i)) diff --git a/scipost_django/mails/tests/test_model_based_backend.py b/scipost_django/mails/tests/test_model_based_backend.py index 1ace4af5d95d4cb5c39b1ec2f032f060bfefb91e..71b3ca589e26fd932c169c02eca9bbbd82781532 100644 --- a/scipost_django/mails/tests/test_model_based_backend.py +++ b/scipost_django/mails/tests/test_model_based_backend.py @@ -1,3 +1,5 @@ +from contextlib import redirect_stdout +from io import StringIO from django.core.management import call_command from django.test import TestCase @@ -87,7 +89,13 @@ class ModelEmailBackendTests(TestCase): mail_util.send_mail() mail_log = MailLog.objects.last() - call_command("send_mails", id=mail_log.id) + + # Capture stdout to check for command output. + stdout = StringIO() + with redirect_stdout(stdout): + call_command("send_mails", id=mail_log.id) + + self.assertIn("Sent 1 mails.", stdout.getvalue()) mail_log.refresh_from_db() self.assertNotEqual(mail_log.body, "") diff --git a/scipost_django/theses/tests/test_forms.py b/scipost_django/theses/tests/test_forms.py index 773e83f8169f5903b2f2e6da3b09385d7a6413e0..7c605272079b9f77effc4fce709770c3d9c517ac 100644 --- a/scipost_django/theses/tests/test_forms.py +++ b/scipost_django/theses/tests/test_forms.py @@ -50,7 +50,5 @@ class TestRequestThesisLink(TestCase): form = RequestThesisLinkForm(form_data, request=self.request) # Check if the user is properly saved to the new ThesisLink as `requested_by` - print(form.is_valid()) - print(form.errors) thesislink = form.save() self.assertEqual(thesislink.requested_by, self.contributor)