예제 #1
0
    def test_management_commands_invalid_file_path(self):

        self.__reset_state()

        file_path = settings.MAINTENANCE_MODE_STATE_FILE_PATH
        settings.MAINTENANCE_MODE_STATE_FILE_PATH = self.invalid_file_path

        with self.assertRaises(CommandError):
            call_command('maintenance_mode', 'on')

        with self.assertRaises(CommandError):
            call_command('maintenance_mode', 'off')

        with self.assertRaises(CommandError):
            cmd = MaintenanceModeCommand()
            cmd.get_maintenance_mode()

        with self.assertRaises(CommandError):
            cmd = MaintenanceModeCommand()
            cmd.set_maintenance_mode(True)

        settings.MAINTENANCE_MODE_STATE_FILE_PATH = file_path
예제 #2
0
    def test_management_commands_invalid_file_path(self):

        self.__reset_state()

        file_path = settings.MAINTENANCE_MODE_STATE_FILE_PATH
        settings.MAINTENANCE_MODE_STATE_FILE_PATH = self.invalid_file_path

        with self.assertRaises(CommandError):
            call_command('maintenance_mode', 'on')

        with self.assertRaises(CommandError):
            call_command('maintenance_mode', 'off')

        with self.assertRaises(CommandError):
            cmd = MaintenanceModeCommand()
            cmd.get_maintenance_mode()

        with self.assertRaises(CommandError):
            cmd = MaintenanceModeCommand()
            cmd.set_maintenance_mode(True)

        settings.MAINTENANCE_MODE_STATE_FILE_PATH = file_path