Skip to content

Commit

Permalink
Fixed #9293: Corrected expected test output for the admin_scripts tes…
Browse files Browse the repository at this point in the history
…ts, following the changes to --verbosity in 9110. Thanks to Alex for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Oct 4, 2008
1 parent 8d98e70 commit a855755
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/regressiontests/admin_scripts/tests.py
Expand Up @@ -921,42 +921,42 @@ def test_base_command(self):
args = ['base_command','testlabel'] args = ['base_command','testlabel']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]") 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')]")


def test_base_command_no_label(self): def test_base_command_no_label(self):
"User BaseCommands can execute when no labels are provided" "User BaseCommands can execute when no labels are provided"
args = ['base_command'] args = ['base_command']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=(), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "EXECUTE:BaseCommand labels=(), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")


def test_base_command_multiple_label(self): def test_base_command_multiple_label(self):
"User BaseCommands can execute when no labels are provided" "User BaseCommands can execute when no labels are provided"
args = ['base_command','testlabel','anotherlabel'] args = ['base_command','testlabel','anotherlabel']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel', 'anotherlabel'), options=[('option_a', '1'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]") 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')]")


def test_base_command_with_option(self): def test_base_command_with_option(self):
"User BaseCommands can execute with options when a label is provided" "User BaseCommands can execute with options when a label is provided"
args = ['base_command','testlabel','--option_a=x'] args = ['base_command','testlabel','--option_a=x']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]") 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')]")


def test_base_command_with_options(self): def test_base_command_with_options(self):
"User BaseCommands can execute with multiple options when a label is provided" "User BaseCommands can execute with multiple options when a label is provided"
args = ['base_command','testlabel','-a','x','--option_b=y'] args = ['base_command','testlabel','-a','x','--option_b=y']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', 'y'), ('option_c', '3'), ('pythonpath', None), ('settings', None), ('traceback', None)]") 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')]")


def test_noargs(self): def test_noargs(self):
"NoArg Commands can be executed" "NoArg Commands can be executed"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand options=[('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "EXECUTE:NoArgsCommand options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")


def test_noargs_with_args(self): def test_noargs_with_args(self):
"NoArg Commands raise an error if an argument is provided" "NoArg Commands raise an error if an argument is provided"
Expand All @@ -971,7 +971,7 @@ def test_app_command(self):
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'") self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'")
self.assertOutput(out, os.sep.join(['django','contrib','auth','models.py'])) self.assertOutput(out, os.sep.join(['django','contrib','auth','models.py']))
self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")


def test_app_command_no_apps(self): def test_app_command_no_apps(self):
"User AppCommands raise an error when no app name is provided" "User AppCommands raise an error when no app name is provided"
Expand All @@ -986,10 +986,10 @@ def test_app_command_multiple_apps(self):
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'") self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'")
self.assertOutput(out, os.sep.join(['django','contrib','auth','models.py'])) self.assertOutput(out, os.sep.join(['django','contrib','auth','models.py']))
self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.contenttypes.models'") self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.contenttypes.models'")
self.assertOutput(out, os.sep.join(['django','contrib','contenttypes','models.py'])) self.assertOutput(out, os.sep.join(['django','contrib','contenttypes','models.py']))
self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")


def test_app_command_invalid_appname(self): def test_app_command_invalid_appname(self):
"User AppCommands can execute when a single app name is provided" "User AppCommands can execute when a single app name is provided"
Expand All @@ -1008,7 +1008,7 @@ def test_label_command(self):
args = ['label_command','testlabel'] args = ['label_command','testlabel']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")


def test_label_command_no_label(self): def test_label_command_no_label(self):
"User LabelCommands raise an error if no label is provided" "User LabelCommands raise an error if no label is provided"
Expand All @@ -1021,8 +1021,8 @@ def test_label_command_multiple_label(self):
args = ['label_command','testlabel','anotherlabel'] args = ['label_command','testlabel','anotherlabel']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "EXECUTE:LabelCommand label=testlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")
self.assertOutput(out, "EXECUTE:LabelCommand label=anotherlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None)]") self.assertOutput(out, "EXECUTE:LabelCommand label=anotherlabel, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]")


class ArgumentOrder(AdminScriptTestCase): class ArgumentOrder(AdminScriptTestCase):
"""Tests for 2-stage argument parsing scheme. """Tests for 2-stage argument parsing scheme.
Expand All @@ -1046,33 +1046,33 @@ def test_setting_then_option(self):
args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x'] args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]") 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')]")


def test_setting_then_short_option(self): def test_setting_then_short_option(self):
"Short options passed after settings are correctly handled" "Short options passed after settings are correctly handled"
args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x'] args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]") 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')]")


def test_option_then_setting(self): def test_option_then_setting(self):
"Options passed before settings are correctly handled" "Options passed before settings are correctly handled"
args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings'] args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]") 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')]")


def test_short_option_then_setting(self): def test_short_option_then_setting(self):
"Short options passed before settings are correctly handled" "Short options passed before settings are correctly handled"
args = ['base_command','testlabel','-a','x','--settings=alternate_settings'] args = ['base_command','testlabel','-a','x','--settings=alternate_settings']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', '2'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]") 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')]")


def test_option_then_setting_then_option(self): def test_option_then_setting_then_option(self):
"Options are correctly handled when they are passed before and after a setting" "Options are correctly handled when they are passed before and after a setting"
args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings','--option_b=y'] args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings','--option_b=y']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:BaseCommand labels=('testlabel',), options=[('option_a', 'x'), ('option_b', 'y'), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None)]") 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')]")


0 comments on commit a855755

Please sign in to comment.