From 44e9280b69d8e000d59ff6bd23b5ca827c016611 Mon Sep 17 00:00:00 2001 From: Seb Date: Tue, 18 Aug 2020 11:30:15 +1000 Subject: [PATCH] New tests --- tests/test_admin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_admin.py b/tests/test_admin.py index 5a39808..e81c5da 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -8,6 +8,7 @@ from wagtail.tests.utils.form_data import (nested_form_data, rich_text, streamfield) from tests.app.models import ExtendedContact, SaleCampaign +from birdsong.models import CampaignStatus class TestCampaignAdmin(WagtailTestUtils, TestCase): @@ -93,10 +94,14 @@ class TestSending(WagtailTestUtils, TransactionTestCase): sleep(10) # Allow time to send self.assertEqual(len(mail.outbox), 1) self.assertTrue('Hi Find Me' in mail.outbox[0].body) + self.assertNotEqual(self.campaign.status, CampaignStatus.SENT) def test_send(self): self.client.get(f'/admin/app/salecampaign/send_campaign/{self.campaign.id}/') sleep(10) # Allow time to send self.assertEquals(len(mail.outbox), 2) - self.assertEqual(self.campaign.receipts.all().count(), 2) + self.assertEquals(self.campaign.receipts.all().count(), 2) + # Get fresh from db (altered in a thread) + fresh_campaign = SaleCampaign.objects.get(pk=self.campaign.pk) + self.assertEquals(fresh_campaign.status, CampaignStatus.SENT)