Esempio n. 1
0
 def test_dry_run(self):
     """Test sending of first notification with debug activated."""
     mentor = UserFactory.create(groups=['Mentor'])
     rep = UserFactory.create(groups=['Rep'], userprofile__mentor=mentor)
     ReportFactoryWithoutSignals.create(user=rep)
     management.call_command('send_first_report_notification', dry_run=True)
     eq_(len(mail.outbox), 0)
Esempio n. 2
0
 def test_send_notification(self):
     """Test sending of first notification to Reps to fill reports."""
     mentor = UserFactory.create(groups=['Mentor'])
     rep = UserFactory.create(groups=['Rep'], userprofile__mentor=mentor)
     ReportFactoryWithoutSignals.create(user=rep)
     management.call_command('send_first_report_notification', [], {})
     eq_(len(mail.outbox), 1)
Esempio n. 3
0
 def test_send_notification(self):
     """Test sending of first notification to Reps to fill reports."""
     mentor = UserFactory.create(groups=['Mentor'])
     rep = UserFactory.create(groups=['Rep'], userprofile__mentor=mentor)
     ReportFactoryWithoutSignals.create(user=rep)
     management.call_command('send_first_report_notification', [], {})
     eq_(len(mail.outbox), 1)
Esempio n. 4
0
 def test_dry_run(self):
     """Test sending of first notification with debug activated."""
     mentor = UserFactory.create(groups=['Mentor'])
     rep = UserFactory.create(groups=['Rep'], userprofile__mentor=mentor)
     ReportFactoryWithoutSignals.create(user=rep)
     management.call_command('send_first_report_notification', dry_run=True)
     eq_(len(mail.outbox), 0)
Esempio n. 5
0
    def test_send_notification_with_reports_filled(self, fake_datetime):
        """Test sending of third notification, with reports filled."""
        # act like it's March 2012
        ReportFactoryWithoutSignals.create(user=self.rep,
                                           month=datetime.date(2012, 1, 1))
        fake_date = datetime.datetime(year=2012, month=3, day=1)
        fake_datetime.today.return_value = fake_date

        management.call_command('send_third_report_notification', [], {})
        eq_(len(mail.outbox), 0)
Esempio n. 6
0
    def test_send_notification_with_reports_filled(self, fake_datetime):
        """Test sending of second notification, with reports filled."""
        # act like it's March 2012
        ReportFactoryWithoutSignals.create(user=self.rep,
                                           month=datetime.date(2012, 1, 1))
        fake_date = datetime.datetime(year=2012, month=3, day=1)
        fake_datetime.today.return_value = fake_date

        management.call_command('send_third_report_notification', [], {})
        eq_(len(mail.outbox), 0)