Ticket #9293: admin-test.diff

File admin-test.diff, 11.3 KB (added by Alex Gaynor, 16 years ago)
  • tests/regressiontests/admin_scripts/tests.py

    diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py
    index 2182488..e772234 100644
    a b class CommandTypes(AdminScriptTestCase):  
    921921        args = ['base_command','testlabel']
    922922        out, err = self.run_manage(args)
    923923        self.assertNoOutput(err)
    924         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]")
     924        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    925925
    926926    def test_base_command_no_label(self):
    927927        "User BaseCommands can execute when no labels are provided"
    928928        args = ['base_command']
    929929        out, err = self.run_manage(args)
    930930        self.assertNoOutput(err)
    931         self.assertOutput(out, "EXECUTE:BaseCommand labels=(), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]")
     931        self.assertOutput(out, "EXECUTE:BaseCommand labels=(), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    932932
    933933    def test_base_command_multiple_label(self):
    934934        "User BaseCommands can execute when no labels are provided"
    935935        args = ['base_command','testlabel','anotherlabel']
    936936        out, err = self.run_manage(args)
    937937        self.assertNoOutput(err)
    938         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel', 'anotherlabel'), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]")
     938        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel', 'anotherlabel'), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    939939
    940940    def test_base_command_with_option(self):
    941941        "User BaseCommands can execute with options when a label is provided"
    942942        args = ['base_command','testlabel','--option_a=x']
    943943        out, err = self.run_manage(args)
    944944        self.assertNoOutput(err)
    945         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]")
     945        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    946946
    947947    def test_base_command_with_options(self):
    948948        "User BaseCommands can execute with multiple options when a label is provided"
    949949        args = ['base_command','testlabel','-a','x','--option_b=y']
    950950        out, err = self.run_manage(args)
    951951        self.assertNoOutput(err)
    952         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', 'y'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]")
     952        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', 'y'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    953953
    954954    def test_noargs(self):
    955955        "NoArg Commands can be executed"
    956956        args = ['noargs_command']
    957957        out, err = self.run_manage(args)
    958958        self.assertNoOutput(err)
    959         self.assertOutput(out, "EXECUTE:NoArgsCommand options=[('pythonpath', None), ('settings', None), ('traceback', None)]")
     959        self.assertOutput(out, "EXECUTE:NoArgsCommand options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    960960
    961961    def test_noargs_with_args(self):
    962962        "NoArg Commands raise an error if an argument is provided"
    class CommandTypes(AdminScriptTestCase):  
    971971        self.assertNoOutput(err)
    972972        self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'")
    973973        self.assertOutput(out, os.sep.join(['django','contrib','auth','models.py']))
    974         self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None)]")
     974        self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    975975
    976976    def test_app_command_no_apps(self):
    977977        "User AppCommands raise an error when no app name is provided"
    class CommandTypes(AdminScriptTestCase):  
    980980        self.assertOutput(err, 'Error: Enter at least one appname.')
    981981
    982982    def test_app_command_multiple_apps(self):
    983         "User AppCommands raise an error when multiple app names are provided"
     983        "User AppCommands raise an error wh en multiple app names are provided"
    984984        args = ['app_command','auth','contenttypes']
    985985        out, err = self.run_manage(args)
    986986        self.assertNoOutput(err)
    987987        self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'")
    988988        self.assertOutput(out, os.sep.join(['django','contrib','auth','models.py']))
    989         self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None)]")
     989        self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    990990        self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.contenttypes.models'")
    991991        self.assertOutput(out, os.sep.join(['django','contrib','contenttypes','models.py']))
    992         self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None)]")
     992        self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    993993
    994994    def test_app_command_invalid_appname(self):
    995995        "User AppCommands can execute when a single app name is provided"
    class CommandTypes(AdminScriptTestCase):  
    10081008        args = ['label_command','testlabel']
    10091009        out, err = self.run_manage(args)
    10101010        self.assertNoOutput(err)
    1011         self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None)]")
     1011        self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    10121012
    10131013    def test_label_command_no_label(self):
    10141014        "User LabelCommands raise an error if no label is provided"
    class CommandTypes(AdminScriptTestCase):  
    10211021        args = ['label_command','testlabel','anotherlabel']
    10221022        out, err = self.run_manage(args)
    10231023        self.assertNoOutput(err)
    1024         self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None)]")
    1025         self.assertOutput(out, "EXECUTE:LabelCommand label=anotherlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None)]")
     1024        self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
     1025        self.assertOutput(out, "EXECUTE:LabelCommand label=anotherlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
    10261026
    10271027class ArgumentOrder(AdminScriptTestCase):
    10281028    """Tests for 2-stage argument parsing scheme.
    class ArgumentOrder(AdminScriptTestCase):  
    10461046        args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x']
    10471047        out, err = self.run_manage(args)
    10481048        self.assertNoOutput(err)
    1049         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]")
     1049        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None), ('verbosity', '1')]")
    10501050
    10511051    def test_setting_then_short_option(self):
    10521052        "Short options passed after settings are correctly handled"
    10531053        args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x']
    10541054        out, err = self.run_manage(args)
    10551055        self.assertNoOutput(err)
    1056         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]")
     1056        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None), ('verbosity', '1')]")
    10571057
    10581058    def test_option_then_setting(self):
    10591059        "Options passed before settings are correctly handled"
    10601060        args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings']
    10611061        out, err = self.run_manage(args)
    10621062        self.assertNoOutput(err)
    1063         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]")
     1063        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None), ('verbosity', '1')]")
    10641064
    10651065    def test_short_option_then_setting(self):
    10661066        "Short options passed before settings are correctly handled"
    10671067        args = ['base_command','testlabel','-a','x','--settings=alternate_settings']
    10681068        out, err = self.run_manage(args)
    10691069        self.assertNoOutput(err)
    1070         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]")
     1070        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None), ('verbosity', '1')]")
    10711071
    10721072    def test_option_then_setting_then_option(self):
    10731073        "Options are correctly handled when they are passed before and after a setting"
    10741074        args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings','--option_b=y']
    10751075        out, err = self.run_manage(args)
    10761076        self.assertNoOutput(err)
    1077         self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', 'y'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]")
     1077        self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', 'y'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None), ('verbosity', '1')]")
    10781078
Back to Top