mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #16734 -- Set script prefix even outside of requests
Thanks Tim Graham for the review.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
|
||||
from admin_scripts.tests import AdminScriptTestCase
|
||||
|
||||
from django.apps import apps
|
||||
from django.core import management
|
||||
from django.core.management import BaseCommand, CommandError, find_commands
|
||||
@@ -159,6 +161,23 @@ class CommandTests(SimpleTestCase):
|
||||
BaseCommand.check = saved_check
|
||||
|
||||
|
||||
class CommandRunTests(AdminScriptTestCase):
|
||||
"""
|
||||
Tests that need to run by simulating the command line, not by call_command.
|
||||
"""
|
||||
def tearDown(self):
|
||||
self.remove_settings('settings.py')
|
||||
|
||||
def test_script_prefix_set_in_commands(self):
|
||||
self.write_settings('settings.py', apps=['user_commands'], sdict={
|
||||
'ROOT_URLCONF': '"user_commands.urls"',
|
||||
'FORCE_SCRIPT_NAME': '"/PREFIX/"',
|
||||
})
|
||||
out, err = self.run_manage(['reverse_url'])
|
||||
self.assertNoOutput(err)
|
||||
self.assertEqual(out.strip(), '/PREFIX/some/url/')
|
||||
|
||||
|
||||
class UtilsTests(SimpleTestCase):
|
||||
|
||||
def test_no_existent_external_program(self):
|
||||
|
||||
Reference in New Issue
Block a user