Browse Source

Merge "django22: Handle changes in management commands"

tags/16.0.0.0b2
Zuul 1 week ago
parent
commit
b2614884ee

+ 15
- 6
horizon/test/unit/management/commands/test_startdash.py View File

@@ -14,6 +14,7 @@
14 14
 
15 15
 import mock
16 16
 
17
+import django
17 18
 from django.core.management import call_command
18 19
 from django.core.management import CommandError
19 20
 from django.test import TestCase
@@ -29,9 +30,17 @@ class CommandsTestCase(TestCase):
29 30
     def test_startdash_usage_correct(self, handle):
30 31
         call_command('startdash', 'test_dash')
31 32
 
32
-        handle.assert_called_with(dash_name='test_dash',
33
-                                  extensions=["py", "tmpl", "html", "js",
34
-                                              "css"],
35
-                                  files=[], no_color=False, pythonpath=None,
36
-                                  settings=None, skip_checks=True, target=None,
37
-                                  template=None, traceback=False, verbosity=1)
33
+        if django.VERSION >= (2, 2):
34
+            handle.assert_called_with(
35
+                dash_name='test_dash',
36
+                extensions=["py", "tmpl", "html", "js", "css"],
37
+                files=[], force_color=False, no_color=False, pythonpath=None,
38
+                settings=None, skip_checks=True, target=None, template=None,
39
+                traceback=False, verbosity=1)
40
+        else:
41
+            handle.assert_called_with(
42
+                dash_name='test_dash',
43
+                extensions=["py", "tmpl", "html", "js", "css"],
44
+                files=[], no_color=False, pythonpath=None,
45
+                settings=None, skip_checks=True, target=None, template=None,
46
+                traceback=False, verbosity=1)

+ 15
- 5
horizon/test/unit/management/commands/test_startpanel.py View File

@@ -14,6 +14,7 @@
14 14
 
15 15
 import mock
16 16
 
17
+import django
17 18
 from django.core.management import call_command
18 19
 from django.core.management import CommandError
19 20
 from django.test import TestCase
@@ -29,8 +30,17 @@ class CommandsTestCase(TestCase):
29 30
     def test_startpanel_usage_correct(self, handle):
30 31
         call_command('startpanel', 'test_dash', '--dashboard=foo.bar')
31 32
 
32
-        handle.assert_called_with(panel_name='test_dash', dashboard='foo.bar',
33
-                                  extensions=["py", "tmpl", "html"],
34
-                                  files=[], no_color=False, pythonpath=None,
35
-                                  settings=None, skip_checks=True, target=None,
36
-                                  template=None, traceback=False, verbosity=1)
33
+        if django.VERSION >= (2, 2):
34
+            handle.assert_called_with(
35
+                panel_name='test_dash', dashboard='foo.bar',
36
+                extensions=["py", "tmpl", "html"],
37
+                files=[], force_color=False, no_color=False, pythonpath=None,
38
+                settings=None, skip_checks=True, target=None,
39
+                template=None, traceback=False, verbosity=1)
40
+        else:
41
+            handle.assert_called_with(
42
+                panel_name='test_dash', dashboard='foo.bar',
43
+                extensions=["py", "tmpl", "html"],
44
+                files=[], no_color=False, pythonpath=None,
45
+                settings=None, skip_checks=True, target=None,
46
+                template=None, traceback=False, verbosity=1)

Loading…
Cancel
Save