<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> import shutil <EOL> import sys <EOL> import re <EOL> from django import conf , bin , get_version <EOL> from django . conf import settings <EOL> class AdminScriptTestCase ( unittest . TestCase ) : <EOL> def write_settings ( self , filename , apps = None ) : <EOL> test_dir = os . path . dirname ( os . path . dirname ( __file__ ) ) <EOL> settings_file = open ( os . path . join ( test_dir , filename ) , '<STR_LIT:w>' ) <EOL> settings_file . write ( '<STR_LIT>' ) <EOL> exports = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> for s in exports : <EOL> if hasattr ( settings , s ) : <EOL> settings_file . write ( "<STR_LIT>" % ( s , str ( getattr ( settings , s ) ) ) ) <EOL> if apps is None : <EOL> apps = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> if apps : <EOL> settings_file . write ( "<STR_LIT>" % apps ) <EOL> settings_file . close ( ) <EOL> def remove_settings ( self , filename ) : <EOL> test_dir = os . path . dirname ( os . path . dirname ( __file__ ) ) <EOL> full_name = os . path . join ( test_dir , filename ) <EOL> os . remove ( full_name ) <EOL> try : <EOL> if sys . platform . startswith ( '<STR_LIT>' ) : <EOL> os . remove ( re . sub ( r'<STR_LIT>' , '<STR_LIT>' , full_name ) ) <EOL> else : <EOL> os . remove ( full_name + '<STR_LIT:c>' ) <EOL> except OSError : <EOL> pass <EOL> def _ext_backend_path ( self ) : <EOL> """<STR_LIT>""" <EOL> first_package_re = re . compile ( r'<STR_LIT>' ) <EOL> result = first_package_re . findall ( settings . DATABASE_ENGINE ) <EOL> if result : <EOL> backend_pkg = __import__ ( result [ <NUM_LIT:0> ] ) <EOL> backend_dir = os . path . dirname ( backend_pkg . __file__ ) <EOL> return os . path . dirname ( backend_dir ) <EOL> def run_test ( self , script , args , settings_file = None , apps = None ) : <EOL> test_dir = os . path . dirname ( os . path . dirname ( __file__ ) ) <EOL> project_dir = os . path . dirname ( test_dir ) <EOL> base_dir = os . path . dirname ( project_dir ) <EOL> ext_backend_base_dir = self . _ext_backend_path ( ) <EOL> old_django_settings_module = os . environ . get ( '<STR_LIT>' , None ) <EOL> if sys . platform . startswith ( '<STR_LIT>' ) : <EOL> python_path_var_name = '<STR_LIT>' <EOL> else : <EOL> python_path_var_name = '<STR_LIT>' <EOL> old_python_path = os . environ . get ( python_path_var_name , None ) <EOL> old_cwd = os . getcwd ( ) <EOL> if settings_file : <EOL> os . environ [ '<STR_LIT>' ] = settings_file <EOL> elif '<STR_LIT>' in os . environ : <EOL> del os . environ [ '<STR_LIT>' ] <EOL> python_path = [ test_dir , base_dir ] <EOL> if ext_backend_base_dir : <EOL> python_path . append ( ext_backend_base_dir ) <EOL> os . environ [ python_path_var_name ] = os . pathsep . join ( python_path ) <EOL> cmd = '<STR_LIT>' % ( sys . executable , script ) <EOL> cmd += '<STR_LIT>' . join ( [ '<STR_LIT>' % arg for arg in args ] ) <EOL> os . chdir ( test_dir ) <EOL> try : <EOL> from subprocess import Popen , PIPE <EOL> p = Popen ( cmd , shell = True , stdin = PIPE , stdout = PIPE , stderr = PIPE ) <EOL> stdin , stdout , stderr = ( p . stdin , p . stdout , p . stderr ) <EOL> except ImportError : <EOL> stdin , stdout , stderr = os . popen3 ( cmd ) <EOL> out , err = stdout . read ( ) , stderr . read ( ) <EOL> if old_django_settings_module : <EOL> os . environ [ '<STR_LIT>' ] = old_django_settings_module <EOL> if old_python_path : <EOL> os . environ [ python_path_var_name ] = old_python_path <EOL> os . chdir ( old_cwd ) <EOL> return out , err <EOL> def run_django_admin ( self , args , settings_file = None ) : <EOL> bin_dir = os . path . dirname ( bin . __file__ ) <EOL> return self . run_test ( os . path . join ( bin_dir , '<STR_LIT>' ) , args , settings_file ) <EOL> def run_manage ( self , args , settings_file = None ) : <EOL> conf_dir = os . path . dirname ( conf . __file__ ) <EOL> template_manage_py = os . path . join ( conf_dir , '<STR_LIT>' , '<STR_LIT>' ) <EOL> test_dir = os . path . dirname ( os . path . dirname ( __file__ ) ) <EOL> test_manage_py = os . path . join ( test_dir , '<STR_LIT>' ) <EOL> shutil . copyfile ( template_manage_py , test_manage_py ) <EOL> stdout , stderr = self . run_test ( '<STR_LIT>' , args , settings_file ) <EOL> os . remove ( test_manage_py ) <EOL> return stdout , stderr <EOL> def assertNoOutput ( self , stream ) : <EOL> "<STR_LIT>" <EOL> self . assertEquals ( len ( stream ) , <NUM_LIT:0> , "<STR_LIT>" % stream ) <EOL> def assertOutput ( self , stream , msg ) : <EOL> "<STR_LIT>" <EOL> self . failUnless ( msg in stream , "<STR_LIT>" % ( msg , stream ) ) <EOL> class DjangoAdminNoSettings ( AdminScriptTestCase ) : <EOL> "<STR_LIT>" <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> class DjangoAdminDefaultSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> class DjangoAdminFullPathDefaultSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> class DjangoAdminMinimalSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' , apps = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> class DjangoAdminAlternateSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> class DjangoAdminMultipleSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' , apps = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_django_admin ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> class ManageNoSettings ( AdminScriptTestCase ) : <EOL> "<STR_LIT>" <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> class ManageDefaultSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> class ManageFullPathDefaultSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> class ManageMinimalSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' , apps = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> class ManageAlternateSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> class ManageMultipleSettings ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' , apps = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_builtin_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , '<STR_LIT>' ) <EOL> def test_builtin_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_builtin_with_bad_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_builtin_with_bad_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_custom_command_with_settings ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_custom_command_with_environment ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args , '<STR_LIT>' ) <EOL> self . assertNoOutput ( out ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> class CommandTypes ( AdminScriptTestCase ) : <EOL> "<STR_LIT>" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_version ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , get_version ( ) . split ( '<STR_LIT:->' ) [ <NUM_LIT:0> ] ) <EOL> def test_help ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> if sys . version_info < ( <NUM_LIT:2> , <NUM_LIT:5> ) : <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> else : <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_specific_help ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_base_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_base_command_no_label ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_base_command_multiple_label ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_base_command_with_option ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_base_command_with_options ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:x>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_noargs ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_noargs_with_args ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_app_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> self . assertOutput ( out , os . sep . join ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_app_command_no_apps ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_app_command_multiple_apps ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> self . assertOutput ( out , os . sep . join ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> self . assertOutput ( out , os . sep . join ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_app_command_invalid_appname ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_app_command_some_invalid_appnames ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertOutput ( err , "<STR_LIT>" ) <EOL> def test_label_command ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_label_command_no_label ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertOutput ( err , '<STR_LIT>' ) <EOL> def test_label_command_multiple_label ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> class ArgumentOrder ( AdminScriptTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . write_settings ( '<STR_LIT>' , apps = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . write_settings ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> self . remove_settings ( '<STR_LIT>' ) <EOL> def test_setting_then_option ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_setting_then_short_option ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_option_then_setting ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_short_option_then_setting ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:x>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) <EOL> def test_option_then_setting_then_option ( self ) : <EOL> "<STR_LIT>" <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> out , err = self . run_manage ( args ) <EOL> self . assertNoOutput ( err ) <EOL> self . assertOutput ( out , "<STR_LIT>" ) </s>
