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):
|
921 | 921 | args = ['base_command','testlabel'] |
922 | 922 | out, err = self.run_manage(args) |
923 | 923 | 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')]") |
925 | 925 | |
926 | 926 | def test_base_command_no_label(self): |
927 | 927 | "User BaseCommands can execute when no labels are provided" |
928 | 928 | args = ['base_command'] |
929 | 929 | out, err = self.run_manage(args) |
930 | 930 | 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')]") |
932 | 932 | |
933 | 933 | def test_base_command_multiple_label(self): |
934 | 934 | "User BaseCommands can execute when no labels are provided" |
935 | 935 | args = ['base_command','testlabel','anotherlabel'] |
936 | 936 | out, err = self.run_manage(args) |
937 | 937 | 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')]") |
939 | 939 | |
940 | 940 | def test_base_command_with_option(self): |
941 | 941 | "User BaseCommands can execute with options when a label is provided" |
942 | 942 | args = ['base_command','testlabel','--option_a=x'] |
943 | 943 | out, err = self.run_manage(args) |
944 | 944 | 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')]") |
946 | 946 | |
947 | 947 | def test_base_command_with_options(self): |
948 | 948 | "User BaseCommands can execute with multiple options when a label is provided" |
949 | 949 | args = ['base_command','testlabel','-a','x','--option_b=y'] |
950 | 950 | out, err = self.run_manage(args) |
951 | 951 | 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')]") |
953 | 953 | |
954 | 954 | def test_noargs(self): |
955 | 955 | "NoArg Commands can be executed" |
956 | 956 | args = ['noargs_command'] |
957 | 957 | out, err = self.run_manage(args) |
958 | 958 | 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')]") |
960 | 960 | |
961 | 961 | def test_noargs_with_args(self): |
962 | 962 | "NoArg Commands raise an error if an argument is provided" |
… |
… |
class CommandTypes(AdminScriptTestCase):
|
971 | 971 | self.assertNoOutput(err) |
972 | 972 | self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'") |
973 | 973 | 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')]") |
975 | 975 | |
976 | 976 | def test_app_command_no_apps(self): |
977 | 977 | "User AppCommands raise an error when no app name is provided" |
… |
… |
class CommandTypes(AdminScriptTestCase):
|
980 | 980 | self.assertOutput(err, 'Error: Enter at least one appname.') |
981 | 981 | |
982 | 982 | 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" |
984 | 984 | args = ['app_command','auth','contenttypes'] |
985 | 985 | out, err = self.run_manage(args) |
986 | 986 | self.assertNoOutput(err) |
987 | 987 | self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'") |
988 | 988 | 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')]") |
990 | 990 | self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.contenttypes.models'") |
991 | 991 | 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')]") |
993 | 993 | |
994 | 994 | def test_app_command_invalid_appname(self): |
995 | 995 | "User AppCommands can execute when a single app name is provided" |
… |
… |
class CommandTypes(AdminScriptTestCase):
|
1008 | 1008 | args = ['label_command','testlabel'] |
1009 | 1009 | out, err = self.run_manage(args) |
1010 | 1010 | 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')]") |
1012 | 1012 | |
1013 | 1013 | def test_label_command_no_label(self): |
1014 | 1014 | "User LabelCommands raise an error if no label is provided" |
… |
… |
class CommandTypes(AdminScriptTestCase):
|
1021 | 1021 | args = ['label_command','testlabel','anotherlabel'] |
1022 | 1022 | out, err = self.run_manage(args) |
1023 | 1023 | 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')]") |
1026 | 1026 | |
1027 | 1027 | class ArgumentOrder(AdminScriptTestCase): |
1028 | 1028 | """Tests for 2-stage argument parsing scheme. |
… |
… |
class ArgumentOrder(AdminScriptTestCase):
|
1046 | 1046 | args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x'] |
1047 | 1047 | out, err = self.run_manage(args) |
1048 | 1048 | 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')]") |
1050 | 1050 | |
1051 | 1051 | def test_setting_then_short_option(self): |
1052 | 1052 | "Short options passed after settings are correctly handled" |
1053 | 1053 | args = ['base_command','testlabel','--settings=alternate_settings','--option_a=x'] |
1054 | 1054 | out, err = self.run_manage(args) |
1055 | 1055 | 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')]") |
1057 | 1057 | |
1058 | 1058 | def test_option_then_setting(self): |
1059 | 1059 | "Options passed before settings are correctly handled" |
1060 | 1060 | args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings'] |
1061 | 1061 | out, err = self.run_manage(args) |
1062 | 1062 | 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')]") |
1064 | 1064 | |
1065 | 1065 | def test_short_option_then_setting(self): |
1066 | 1066 | "Short options passed before settings are correctly handled" |
1067 | 1067 | args = ['base_command','testlabel','-a','x','--settings=alternate_settings'] |
1068 | 1068 | out, err = self.run_manage(args) |
1069 | 1069 | 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')]") |
1071 | 1071 | |
1072 | 1072 | def test_option_then_setting_then_option(self): |
1073 | 1073 | "Options are correctly handled when they are passed before and after a setting" |
1074 | 1074 | args = ['base_command','testlabel','--option_a=x','--settings=alternate_settings','--option_b=y'] |
1075 | 1075 | out, err = self.run_manage(args) |
1076 | 1076 | 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')]") |
1078 | 1078 | |