def test_post_save_when_no_aq_project(self):

        project = ProjectFactory.create(status='active')

        project.status = 'deleted'
        project.save

        post_save_project(Project, instance=project)

        self.assertEquals(len(mail.outbox), 0)
    def test_post_save_when_no_aq_project(self):

        project = ProjectFactory.create(status='active')

        project.status = 'deleted'
        project.save

        post_save_project(Project, instance=project)

        self.assertEquals(len(mail.outbox), 0)
    def test_post_save_when_project_made_deleted(self):

        project = ProjectFactory.create(status='active')
        aq_project = AirQualityProjectFactory.create(project=project)

        project.status = 'deleted'
        project.save

        post_save_project(Project, instance=project)

        self.assertEqual(
            AirQualityProject.objects.filter(pk=aq_project.id).exists(), False)
        self.assertEquals(len(mail.outbox), 1)
    def test_post_save_when_project_made_deleted(self):

        project = ProjectFactory.create(status='active')
        aq_project = AirQualityProjectFactory.create(project=project)

        project.status = 'deleted'
        project.save

        post_save_project(Project, instance=project)

        self.assertEqual(
            AirQualityProject.objects.filter(pk=aq_project.id).exists(),
            False
        )
        self.assertEquals(len(mail.outbox), 1)