예제 #1
0
 def test_teams_search_flag_disabled_raises_command_error(self):
     """ Test that raises CommandError for disabled feature flag. """
     with mock.patch('django.conf.settings.FEATURES') as features:
         features.return_value = {"ENABLE_TEAMS": False}
         with self.assertRaises(SystemExit), nostderr():
             with self.assertRaisesRegexp(CommandError, ".* ENABLE_TEAMS must be enabled .*"):
                 call_command('reindex_course_team')
예제 #2
0
 def test_given_invalid_team_id_raises_command_error(self):
     """ Test that raises CommandError for invalid team id. """
     with self.assertRaises(SystemExit), nostderr():
         with self.assertRaisesRegexp(
                 CommandError,
                 ".* Argument {0} is not a course_team id .*"):
             call_command('reindex_course_team', u'team4')
    def test_given_course_key_raises_command_error(self):
        """ Test that raises CommandError if course key is passed """
        with self.assertRaises(SystemExit), nostderr():
            with self.assertRaisesRegexp(CommandError, ".* is not a library key"):
                call_command('reindex_library', unicode(self.first_course.id))

        with self.assertRaises(SystemExit), nostderr():
            with self.assertRaisesRegexp(CommandError, ".* is not a library key"):
                call_command('reindex_library', unicode(self.second_course.id))

        with self.assertRaises(SystemExit), nostderr():
            with self.assertRaisesRegexp(CommandError, ".* is not a library key"):
                call_command(
                    'reindex_library',
                    unicode(self.second_course.id),
                    unicode(self._get_lib_key(self.first_lib))
                )
예제 #4
0
    def test_given_course_key_raises_command_error(self):
        """ Test that raises CommandError if course key is passed """
        with self.assertRaises(SystemExit), nostderr():
            with self.assertRaisesRegexp(CommandError,
                                         ".* is not a library key"):
                call_command('reindex_library', unicode(self.first_course.id))

        with self.assertRaises(SystemExit), nostderr():
            with self.assertRaisesRegexp(CommandError,
                                         ".* is not a library key"):
                call_command('reindex_library', unicode(self.second_course.id))

        with self.assertRaises(SystemExit), nostderr():
            with self.assertRaisesRegexp(CommandError,
                                         ".* is not a library key"):
                call_command('reindex_library', unicode(self.second_course.id),
                             unicode(self._get_lib_key(self.first_lib)))
예제 #5
0
 def test_given_no_arguments_raises_command_error(self):
     """ Test that raises CommandError for incorrect arguments """
     with self.assertRaises(SystemExit), nostderr():
         with self.assertRaisesRegexp(
                 CommandError, ".* requires one or more arguments .*"):
             call_command('reindex_course')
 def test_given_invalid_team_id_raises_command_error(self):
     """ Test that raises CommandError for invalid team id. """
     with self.assertRaises(SystemExit), nostderr():
         with self.assertRaisesRegexp(CommandError, ".* Argument {0} is not a course_team id .*"):
             call_command('reindex_course_team', u'team4')
 def test_given_no_arguments_raises_command_error(self):
     """ Test that raises CommandError for incorrect arguments. """
     with self.assertRaises(SystemExit), nostderr():
         with self.assertRaisesRegexp(CommandError, ".* requires one or more arguments .*"):
             call_command('reindex_course_team')