Created
August 21, 2017 21:21
-
-
Save d4vsanchez/70bc5a07ace9cdda08179bd6bbb9eee9 to your computer and use it in GitHub Desktop.
First version of the tests for the report model example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core import mail | |
from django.test import TestCase | |
from reports.models.report import Report | |
class ReportTest(TestCase): | |
def tearDown(self): | |
Report.objects.all().delete() | |
mail.outbox = [] | |
def test_create_report_and_send_by_email(self): | |
info = # This is a dict with the information of the fake Report | |
report = Report.objects.create(**info) | |
# There shouldn't be emails in the outbox | |
self.assertEqual(len(mail.outbox), 0) | |
report.create_report_and_send_by_email(self) | |
# There should be one email in the outbox | |
self.assertEqual(len(mail.outbox), 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment