Example #1
0
    def test_invalid_date(self, mocked_date):
        model = ContentType.objects.get_for_model(UserProfile)
        items = ActionItem.objects.filter(content_type=model)
        ok_(not items.exists())

        UserFactory.create_batch(2, groups=['Mentor'])
        mocked_date.return_value = datetime(now().year, now().month, 2)
        send_rotm_nomination_reminder()

        items = ActionItem.objects.filter(content_type=model)
        ok_(not items.exists())
Example #2
0
    def test_invalid_date(self, mocked_date):
        model = ContentType.objects.get_for_model(UserProfile)
        items = ActionItem.objects.filter(content_type=model)
        ok_(not items.exists())

        UserFactory.create_batch(2, groups=['Mentor'])
        mocked_date.return_value = datetime(now().year, now().month, 2)
        send_rotm_nomination_reminder()

        items = ActionItem.objects.filter(content_type=model)
        ok_(not items.exists())
Example #3
0
    def test_base(self, mocked_date):
        model = ContentType.objects.get_for_model(UserProfile)
        items = ActionItem.objects.filter(content_type=model)
        ok_(not items.exists())

        mentors = UserFactory.create_batch(2, groups=['Mentor'])
        mocked_date.return_value = datetime(now().year, now().month, 1)
        send_rotm_nomination_reminder()

        items = ActionItem.objects.filter(content_type=model)

        eq_(items.count(), 2)
        eq_(set([mentor.id for mentor in mentors]),
            set(items.values_list('object_id', flat=True)))
Example #4
0
    def test_base(self, mocked_date):
        model = ContentType.objects.get_for_model(UserProfile)
        items = ActionItem.objects.filter(content_type=model)
        ok_(not items.exists())

        mentors = UserFactory.create_batch(2, groups=['Mentor'])
        mocked_date.return_value = datetime(now().year, now().month, 1)
        send_rotm_nomination_reminder()

        items = ActionItem.objects.filter(content_type=model)

        eq_(items.count(), 2)
        eq_(set([mentor.id for mentor in mentors]),
            set(items.values_list('object_id', flat=True)))
Example #5
0
    def test_nominate_notification_base(self, mocked_date, mail_mock):
        UserFactory.create(groups=['Mentor'])
        subject = 'Nominate Rep of the month'
        mentor_alias = settings.REPS_MENTORS_LIST

        mocked_date.return_value = datetime(now().year, now().month, 1)
        send_rotm_nomination_reminder()

        ok_(mail_mock.called)
        eq_(mail_mock.call_count, 1)
        expected_call_list = [call(recipients_list=[mentor_alias],
                                   subject=subject,
                                   data={'month': number2month(now().month)},
                                   email_template=ANY)]
        eq_(mail_mock.call_args_list, expected_call_list)
Example #6
0
    def test_nominate_notification_base(self, mocked_date, mail_mock):
        UserFactory.create(groups=['Mentor'])
        subject = 'Nominate Rep of the month'
        mentor_alias = settings.REPS_MENTORS_LIST

        mocked_date.return_value = datetime(now().year, now().month, 1)
        send_rotm_nomination_reminder()

        ok_(mail_mock.called)
        eq_(mail_mock.call_count, 1)
        expected_call_list = [call(recipients_list=[mentor_alias],
                                   subject=subject,
                                   data={'month': number2month(now().month)},
                                   email_template=ANY)]
        eq_(mail_mock.call_args_list, expected_call_list)
Example #7
0
    def test_nominate_notification_invalid_date(self, mocked_date, mail_mock):
        UserFactory.create(groups=["Rep"])

        send_rotm_nomination_reminder()

        ok_(not mail_mock.called)
Example #8
0
    def test_nominate_notification_invalid_date(self, mocked_date, mail_mock):
        UserFactory.create(groups=['Rep'])

        send_rotm_nomination_reminder()

        ok_(not mail_mock.called)