Пример #1
0
 def test_handle_course_deactivate(self):
     with patch(
             'bulk_email.management.commands.deactivate_bulk_email.get_user_by_username_or_email',
             return_value=self.user) as user_mock:
         deactivate_bulk_email.Command().handle(*self.args,
                                                **self.course_kwargs)
         user_mock.assert_called_once_with("*****@*****.**")
Пример #2
0
 def test_handle_deactivate(self, optout_mock):
     with patch(
             'bulk_email.management.commands.deactivate_bulk_email.get_user_by_username_or_email',
             return_value=self.user) as user_mock:
         deactivate_bulk_email.Command().handle(*self.args, **self.kwargs)
         user_mock.assert_called_once_with("*****@*****.**")
         optout_mock.assert_called_once_with(course_id=self.course.id,
                                             force_disabled=True,
                                             user=self.user)
Пример #3
0
 def test_handle_forcedisabled(self):
     with patch(
             'bulk_email.management.commands.deactivate_bulk_email.get_user_by_username_or_email',
             return_value=self.forcedisabled_user
     ) as forcedisabled_user_mock:
         deactivate_bulk_email.Command().handle(*self.forcedisabled_args,
                                                **self.kwargs)
         forcedisabled_user_mock.assert_called_once_with(
             "*****@*****.**")
Пример #4
0
 def test_handle_nouser(self):
     with self.assertRaises(CommandError):
         deactivate_bulk_email.Command().handle(*self.nouser_args,
                                                **self.kwargs)
Пример #5
0
 def test_handle_toomanyargs(self):
     with self.assertRaises(CommandError):
         deactivate_bulk_email.Command().handle(*self.toomanyargs_args,
                                                **self.kwargs)