summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lower-constraints.txt4
-rw-r--r--muranodashboard/tests/settings.py9
-rw-r--r--muranodashboard/tests/test_utils.py4
-rw-r--r--muranodashboard/tests/unit/catalog/test_views.py24
-rw-r--r--muranodashboard/tests/unit/categories/test_views.py4
-rw-r--r--muranodashboard/tests/unit/common/test_net.py4
-rw-r--r--muranodashboard/tests/unit/common/test_utils.py13
-rw-r--r--muranodashboard/tests/unit/dynamic_ui/test_fields.py48
-rw-r--r--muranodashboard/tests/unit/dynamic_ui/test_forms.py17
-rw-r--r--muranodashboard/tests/unit/dynamic_ui/test_helpers.py4
-rw-r--r--muranodashboard/tests/unit/dynamic_ui/test_versions.py4
-rw-r--r--muranodashboard/tests/unit/dynamic_ui/test_yaql_expression.py4
-rw-r--r--muranodashboard/tests/unit/dynamic_ui/test_yaql_functions.py4
-rw-r--r--muranodashboard/tests/unit/environments/test_forms.py4
-rw-r--r--muranodashboard/tests/unit/environments/test_tables.py30
-rw-r--r--muranodashboard/tests/unit/environments/test_tabs.py24
-rw-r--r--muranodashboard/tests/unit/environments/test_views.py22
-rw-r--r--muranodashboard/tests/unit/images/test_forms.py6
-rw-r--r--muranodashboard/tests/unit/images/test_views.py8
-rw-r--r--muranodashboard/tests/unit/packages/test_tables.py14
-rw-r--r--test-requirements.txt5
-rw-r--r--tox.ini7
22 files changed, 130 insertions, 133 deletions
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 86fb936..0cc1f50 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -22,7 +22,6 @@ django-babel==0.6.2
22django-compressor==2.0 22django-compressor==2.0
23django-floppyforms==1.7.0 23django-floppyforms==1.7.0
24django-formtools==2.0 24django-formtools==2.0
25django-nose==1.4.4
26django-pyscss==2.0.2 25django-pyscss==2.0.2
27docutils==0.14 26docutils==0.14
28dogpile.cache==0.6.5 27dogpile.cache==0.6.5
@@ -54,9 +53,6 @@ murano-pkg-check==0.3.0
54netaddr==0.7.19 53netaddr==0.7.19
55netifaces==0.10.6 54netifaces==0.10.6
56nodeenv==0.9.4 55nodeenv==0.9.4
57nose==1.3.7
58nosehtmloutput==0.0.3
59openstack.nose-plugin==0.7
60openstackdocstheme==1.18.1 56openstackdocstheme==1.18.1
61openstacksdk==0.12.0 57openstacksdk==0.12.0
62os-client-config==1.29.0 58os-client-config==1.29.0
diff --git a/muranodashboard/tests/settings.py b/muranodashboard/tests/settings.py
index 37d8f35..20af5b0 100644
--- a/muranodashboard/tests/settings.py
+++ b/muranodashboard/tests/settings.py
@@ -29,11 +29,6 @@ TESTSERVER = 'http://testserver'
29 29
30MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' 30MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
31 31
32TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
33NOSE_ARGS = ['--nocapture',
34 '--nologcapture',
35 '--cover-package=muranodashboard']
36
37EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend' 32EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
38SESSION_ENGINE = 'django.contrib.sessions.backends.cache' 33SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
39 34
@@ -74,9 +69,5 @@ LOGGING = {
74 'handlers': ['null'], 69 'handlers': ['null'],
75 'propagate': False, 70 'propagate': False,
76 }, 71 },
77 'nose.plugins.manager': {
78 'handlers': ['null'],
79 'propagate': False,
80 }
81 } 72 }
82} 73}
diff --git a/muranodashboard/tests/test_utils.py b/muranodashboard/tests/test_utils.py
index df14495..ee4cb8a 100644
--- a/muranodashboard/tests/test_utils.py
+++ b/muranodashboard/tests/test_utils.py
@@ -12,12 +12,12 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14 14
15import testtools 15import unittest
16 16
17from muranodashboard.common import utils 17from muranodashboard.common import utils
18 18
19 19
20class BunchTests(testtools.TestCase): 20class TestBunch(unittest.TestCase):
21 def test_get_attr(self): 21 def test_get_attr(self):
22 obj = utils.Bunch(one=10) 22 obj = utils.Bunch(one=10)
23 23
diff --git a/muranodashboard/tests/unit/catalog/test_views.py b/muranodashboard/tests/unit/catalog/test_views.py
index 1795883..0ac18e5 100644
--- a/muranodashboard/tests/unit/catalog/test_views.py
+++ b/muranodashboard/tests/unit/catalog/test_views.py
@@ -14,7 +14,7 @@
14 14
15import collections 15import collections
16import mock 16import mock
17import testtools 17import unittest
18 18
19from django.conf import settings 19from django.conf import settings
20from django.forms import formsets 20from django.forms import formsets
@@ -34,7 +34,7 @@ except ImportError:
34 from urllib.parse import urlparse 34 from urllib.parse import urlparse
35 35
36 36
37class TestCatalogViews(testtools.TestCase): 37class TestCatalogViews(unittest.TestCase):
38 def setUp(self): 38 def setUp(self):
39 super(TestCatalogViews, self).setUp() 39 super(TestCatalogViews, self).setUp()
40 self.mock_request = mock.MagicMock(session={}) 40 self.mock_request = mock.MagicMock(session={})
@@ -177,7 +177,7 @@ class TestCatalogViews(testtools.TestCase):
177 **expected_params) 177 **expected_params)
178 178
179 179
180class TestLazyWizard(testtools.TestCase): 180class TestLazyWizard(unittest.TestCase):
181 181
182 @mock.patch.object(views.LazyWizard, 'http_method_names', 182 @mock.patch.object(views.LazyWizard, 'http_method_names',
183 new_callable=mock.PropertyMock) 183 new_callable=mock.PropertyMock)
@@ -189,16 +189,20 @@ class TestLazyWizard(testtools.TestCase):
189 expected_error_msg = "You tried to pass in the {0} method name as a "\ 189 expected_error_msg = "You tried to pass in the {0} method name as a "\
190 "keyword argument to LazyWizard(). "\ 190 "keyword argument to LazyWizard(). "\
191 "Don't do that.".format("patch") 191 "Don't do that.".format("patch")
192 e = self.assertRaises(TypeError, views.LazyWizard.as_view, 192
193 None, **kwargs) 193 with self.assertRaises(TypeError) as cm:
194 views.LazyWizard.as_view(None, **kwargs)
195 e = cm.exception
194 self.assertEqual(expected_error_msg, str(e)) 196 self.assertEqual(expected_error_msg, str(e))
195 197
196 # Test that second occurrence of type error is thrown. 198 # Test that second occurrence of type error is thrown.
197 kwargs = {'foobar': ''} 199 kwargs = {'foobar': ''}
198 expected_error_msg = "LazyWizard() received an invalid keyword "\ 200 expected_error_msg = "LazyWizard() received an invalid keyword "\
199 "'foobar'" 201 "'foobar'"
200 e = self.assertRaises(TypeError, views.LazyWizard.as_view, 202
201 None, **kwargs) 203 with self.assertRaises(TypeError) as cm:
204 views.LazyWizard.as_view(None, **kwargs)
205 e = cm.exception
202 self.assertEqual(expected_error_msg, str(e)) 206 self.assertEqual(expected_error_msg, str(e))
203 207
204 @mock.patch.object(views.LazyWizard, 'dispatch') 208 @mock.patch.object(views.LazyWizard, 'dispatch')
@@ -220,7 +224,7 @@ class TestLazyWizard(testtools.TestCase):
220 mock_dispatch.assert_called_once_with(mock_request, **kwargs) 224 mock_dispatch.assert_called_once_with(mock_request, **kwargs)
221 225
222 226
223class TestWizard(testtools.TestCase): 227class TestWizard(unittest.TestCase):
224 228
225 def setUp(self): 229 def setUp(self):
226 super(TestWizard, self).setUp() 230 super(TestWizard, self).setUp()
@@ -488,7 +492,7 @@ class TestWizard(testtools.TestCase):
488 mock_nova.flavor_list.assert_called_once_with(self.wizard.request) 492 mock_nova.flavor_list.assert_called_once_with(self.wizard.request)
489 493
490 494
491class TestIndexView(testtools.TestCase): 495class TestIndexView(unittest.TestCase):
492 496
493 def setUp(self): 497 def setUp(self):
494 super(TestIndexView, self).setUp() 498 super(TestIndexView, self).setUp()
@@ -669,7 +673,7 @@ class TestIndexView(testtools.TestCase):
669 'horizon:app-catalog:packages:index') 673 'horizon:app-catalog:packages:index')
670 674
671 675
672class TestAppDetailsView(testtools.TestCase): 676class TestAppDetailsView(unittest.TestCase):
673 677
674 def setUp(self): 678 def setUp(self):
675 super(TestAppDetailsView, self).setUp() 679 super(TestAppDetailsView, self).setUp()
diff --git a/muranodashboard/tests/unit/categories/test_views.py b/muranodashboard/tests/unit/categories/test_views.py
index efe1144..584efe3 100644
--- a/muranodashboard/tests/unit/categories/test_views.py
+++ b/muranodashboard/tests/unit/categories/test_views.py
@@ -13,13 +13,13 @@
13# under the License. 13# under the License.
14 14
15import mock 15import mock
16import testtools 16import unittest
17 17
18from muranodashboard.categories import tables 18from muranodashboard.categories import tables
19from muranodashboard.categories import views 19from muranodashboard.categories import views
20 20
21 21
22class TestCategoriesView(testtools.TestCase): 22class TestCategoriesView(unittest.TestCase):
23 23
24 def setUp(self): 24 def setUp(self):
25 super(TestCategoriesView, self).setUp() 25 super(TestCategoriesView, self).setUp()
diff --git a/muranodashboard/tests/unit/common/test_net.py b/muranodashboard/tests/unit/common/test_net.py
index 5115c96..6e698dc 100644
--- a/muranodashboard/tests/unit/common/test_net.py
+++ b/muranodashboard/tests/unit/common/test_net.py
@@ -13,14 +13,14 @@
13# under the License. 13# under the License.
14 14
15import mock 15import mock
16import testtools 16import unittest
17 17
18from horizon import exceptions 18from horizon import exceptions
19 19
20from muranodashboard.common import net 20from muranodashboard.common import net
21 21
22 22
23class TestNet(testtools.TestCase): 23class TestNet(unittest.TestCase):
24 24
25 def setUp(self): 25 def setUp(self):
26 super(TestNet, self).setUp() 26 super(TestNet, self).setUp()
diff --git a/muranodashboard/tests/unit/common/test_utils.py b/muranodashboard/tests/unit/common/test_utils.py
index 273f621..416ae22 100644
--- a/muranodashboard/tests/unit/common/test_utils.py
+++ b/muranodashboard/tests/unit/common/test_utils.py
@@ -18,14 +18,14 @@ except ImportError:
18 import pickle 18 import pickle
19 19
20import mock 20import mock
21import testtools 21import unittest
22import yaql 22import yaql
23 23
24from muranodashboard.common import utils 24from muranodashboard.common import utils
25from muranodashboard.dynamic_ui import yaql_expression 25from muranodashboard.dynamic_ui import yaql_expression
26 26
27 27
28class TestUtils(testtools.TestCase): 28class TestUtils(unittest.TestCase):
29 29
30 def test_parse_api_error(self): 30 def test_parse_api_error(self):
31 test_html = '<html><body><h1>Foo Header</h1>Foo Error </body></html>' 31 test_html = '<html><body><h1>Foo Header</h1>Foo Error </body></html>'
@@ -36,7 +36,7 @@ class TestUtils(testtools.TestCase):
36 self.assertIsNone(utils.parse_api_error(test_html)) 36 self.assertIsNone(utils.parse_api_error(test_html))
37 37
38 38
39class TestCustomPickler(testtools.TestCase): 39class TestCustomPickler(unittest.TestCase):
40 40
41 def setUp(self): 41 def setUp(self):
42 super(TestCustomPickler, self).setUp() 42 super(TestCustomPickler, self).setUp()
@@ -53,7 +53,7 @@ class TestCustomPickler(testtools.TestCase):
53 self.assertIsNone(self.custom_pickler.persistent_id(None)) 53 self.assertIsNone(self.custom_pickler.persistent_id(None))
54 54
55 55
56class TestCustomUnpickler(testtools.TestCase): 56class TestCustomUnpickler(unittest.TestCase):
57 57
58 def setUp(self): 58 def setUp(self):
59 super(TestCustomUnpickler, self).setUp() 59 super(TestCustomUnpickler, self).setUp()
@@ -67,6 +67,7 @@ class TestCustomUnpickler(testtools.TestCase):
67 self.assertEqual(yaql_expression.YAQL, result) 67 self.assertEqual(yaql_expression.YAQL, result)
68 68
69 def test_persistent_load_with_wrong_obj_type(self): 69 def test_persistent_load_with_wrong_obj_type(self):
70 e = self.assertRaises(pickle.UnpicklingError, 70 with self.assertRaises(pickle.UnpicklingError) as cm:
71 self.custom_unpickler.persistent_load, None) 71 self.custom_unpickler.persistent_load(None)
72 e = cm.exception
72 self.assertEqual('Invalid persistent id', str(e)) 73 self.assertEqual('Invalid persistent id', str(e))
diff --git a/muranodashboard/tests/unit/dynamic_ui/test_fields.py b/muranodashboard/tests/unit/dynamic_ui/test_fields.py
index 84ef171..95d30a1 100644
--- a/muranodashboard/tests/unit/dynamic_ui/test_fields.py
+++ b/muranodashboard/tests/unit/dynamic_ui/test_fields.py
@@ -18,12 +18,12 @@ from django import forms
18from django.utils.translation import ugettext_lazy as _ 18from django.utils.translation import ugettext_lazy as _
19 19
20import mock 20import mock
21import testtools 21import unittest
22 22
23from muranodashboard.dynamic_ui import fields 23from muranodashboard.dynamic_ui import fields
24 24
25 25
26class TestFields(testtools.TestCase): 26class TestFields(unittest.TestCase):
27 27
28 def setUp(self): 28 def setUp(self):
29 super(TestFields, self).setUp() 29 super(TestFields, self).setUp()
@@ -62,9 +62,10 @@ class TestFields(testtools.TestCase):
62 62
63 @mock.patch.object(fields, 'LOG') 63 @mock.patch.object(fields, 'LOG')
64 def test_fields_except_validation_error(self, mock_log): 64 def test_fields_except_validation_error(self, mock_log):
65 with self.assertRaisesRegex(forms.ValidationError, 65 with self.assertRaises(forms.ValidationError) as cm:
66 "Can't get a request information"):
67 self._test_fields_decorator_with_validation_error({}, request=None) 66 self._test_fields_decorator_with_validation_error({}, request=None)
67 e = cm.exception
68 self.assertEqual("Can't get a request information", e.message)
68 mock_log.error.assert_called_once_with( 69 mock_log.error.assert_called_once_with(
69 "No 'request' value passed neither via initial dictionary, nor " 70 "No 'request' value passed neither via initial dictionary, nor "
70 "directly") 71 "directly")
@@ -92,7 +93,9 @@ class TestFields(testtools.TestCase):
92 93
93 validator_func = fields.make_yaql_validator(mock_validator_property) 94 validator_func = fields.make_yaql_validator(mock_validator_property)
94 self.assertTrue(hasattr(validator_func, '__call__')) 95 self.assertTrue(hasattr(validator_func, '__call__'))
95 e = self.assertRaises(forms.ValidationError, validator_func, 'bar') 96 with self.assertRaises(forms.ValidationError) as cm:
97 validator_func('bar')
98 e = cm.exception
96 self.assertEqual('foo_message', e.message) 99 self.assertEqual('foo_message', e.message)
97 100
98 def test_get_regex_validator(self): 101 def test_get_regex_validator(self):
@@ -124,9 +127,11 @@ class TestFields(testtools.TestCase):
124 def _validator(value): 127 def _validator(value):
125 raise forms.ValidationError(None) 128 raise forms.ValidationError(None)
126 129
127 with self.assertRaisesRegex(forms.ValidationError, 'foo'): 130 with self.assertRaises(forms.ValidationError) as cm:
128 func = fields.wrap_regex_validator(_validator, 'foo') 131 func = fields.wrap_regex_validator(_validator, 'foo')
129 func(None) 132 func(None)
133 e = cm.exception
134 self.assertEqual('foo', e.message)
130 135
131 @mock.patch.object(fields, 'glance') 136 @mock.patch.object(fields, 'glance')
132 def test_get_murano_images(self, mock_glance): 137 def test_get_murano_images(self, mock_glance):
@@ -328,7 +333,7 @@ class TestFields(testtools.TestCase):
328 self.assertEqual('value', dynamic_select.clean('value')) 333 self.assertEqual('value', dynamic_select.clean('value'))
329 334
330 335
331class TestRawProperty(testtools.TestCase): 336class TestRawProperty(unittest.TestCase):
332 337
333 def test_finalize(self): 338 def test_finalize(self):
334 class Control(object): 339 class Control(object):
@@ -366,7 +371,7 @@ class TestRawProperty(testtools.TestCase):
366 self.assertNotIn('prop', ctl.__dict__) 371 self.assertNotIn('prop', ctl.__dict__)
367 372
368 373
369class TestCustomPropertiesField(testtools.TestCase): 374class TestCustomPropertiesField(unittest.TestCase):
370 375
371 def setUp(self): 376 def setUp(self):
372 super(TestCustomPropertiesField, self).setUp() 377 super(TestCustomPropertiesField, self).setUp()
@@ -421,7 +426,7 @@ class TestCustomPropertiesField(testtools.TestCase):
421 self.assertIsNotNone(result) 426 self.assertIsNotNone(result)
422 427
423 428
424class TestPasswordField(testtools.TestCase): 429class TestPasswordField(unittest.TestCase):
425 430
426 def setUp(self): 431 def setUp(self):
427 super(TestPasswordField, self).setUp() 432 super(TestPasswordField, self).setUp()
@@ -470,7 +475,7 @@ class TestPasswordField(testtools.TestCase):
470 self.assertEqual('Retype your password', result.help_text) 475 self.assertEqual('Retype your password', result.help_text)
471 476
472 477
473class TestFlavorChoiceField(testtools.TestCase): 478class TestFlavorChoiceField(unittest.TestCase):
474 479
475 def setUp(self): 480 def setUp(self):
476 super(TestFlavorChoiceField, self).setUp() 481 super(TestFlavorChoiceField, self).setUp()
@@ -551,7 +556,7 @@ class TestFlavorChoiceField(testtools.TestCase):
551 self.assertEqual('id3', self.flavor_choice_field.initial) 556 self.assertEqual('id3', self.flavor_choice_field.initial)
552 557
553 558
554class TestKeyPairChoiceField(testtools.TestCase): 559class TestKeyPairChoiceField(unittest.TestCase):
555 560
556 def setUp(self): 561 def setUp(self):
557 super(TestKeyPairChoiceField, self).setUp() 562 super(TestKeyPairChoiceField, self).setUp()
@@ -578,7 +583,7 @@ class TestKeyPairChoiceField(testtools.TestCase):
578 sorted(key_pair_choice_field.choices)) 583 sorted(key_pair_choice_field.choices))
579 584
580 585
581class TestSecurityGroupChoiceField(testtools.TestCase): 586class TestSecurityGroupChoiceField(unittest.TestCase):
582 587
583 def setUp(self): 588 def setUp(self):
584 super(TestSecurityGroupChoiceField, self).setUp() 589 super(TestSecurityGroupChoiceField, self).setUp()
@@ -603,7 +608,7 @@ class TestSecurityGroupChoiceField(testtools.TestCase):
603 sorted(security_group_choice_field.choices)) 608 sorted(security_group_choice_field.choices))
604 609
605 610
606class TestImageChoiceField(testtools.TestCase): 611class TestImageChoiceField(unittest.TestCase):
607 612
608 def setUp(self): 613 def setUp(self):
609 super(TestImageChoiceField, self).setUp() 614 super(TestImageChoiceField, self).setUp()
@@ -645,7 +650,7 @@ class TestImageChoiceField(testtools.TestCase):
645 self.assertEqual(expected_choices, image_choice_field.choices) 650 self.assertEqual(expected_choices, image_choice_field.choices)
646 651
647 652
648class TestNetworkChoiceField(testtools.TestCase): 653class TestNetworkChoiceField(unittest.TestCase):
649 654
650 def setUp(self): 655 def setUp(self):
651 super(TestNetworkChoiceField, self).setUp() 656 super(TestNetworkChoiceField, self).setUp()
@@ -677,7 +682,7 @@ class TestNetworkChoiceField(testtools.TestCase):
677 self.network_choice_field.to_python(None)) 682 self.network_choice_field.to_python(None))
678 683
679 684
680class TestVolumeChoiceField(testtools.TestCase): 685class TestVolumeChoiceField(unittest.TestCase):
681 686
682 def setUp(self): 687 def setUp(self):
683 super(TestVolumeChoiceField, self).setUp() 688 super(TestVolumeChoiceField, self).setUp()
@@ -818,7 +823,7 @@ class TestVolumeChoiceField(testtools.TestCase):
818 mock_exceptions.handle.assert_has_calls(expected_calls) 823 mock_exceptions.handle.assert_has_calls(expected_calls)
819 824
820 825
821class TestAZoneChoiceField(testtools.TestCase): 826class TestAZoneChoiceField(unittest.TestCase):
822 827
823 @mock.patch.object(fields, 'nova') 828 @mock.patch.object(fields, 'nova')
824 def test_update(self, mock_nova): 829 def test_update(self, mock_nova):
@@ -852,7 +857,7 @@ class TestAZoneChoiceField(testtools.TestCase):
852 mock_exc.handle.assert_called_once_with(request['request'], mock.ANY) 857 mock_exc.handle.assert_called_once_with(request['request'], mock.ANY)
853 858
854 859
855class TestBooleanField(testtools.TestCase): 860class TestBooleanField(unittest.TestCase):
856 861
857 def test_boolean_field(self): 862 def test_boolean_field(self):
858 class Widget(object): 863 class Widget(object):
@@ -870,7 +875,7 @@ class TestBooleanField(testtools.TestCase):
870 self.assertFalse(boolean_field.required) 875 self.assertFalse(boolean_field.required)
871 876
872 877
873class TestDatabaseListField(testtools.TestCase): 878class TestDatabaseListField(unittest.TestCase):
874 879
875 def setUp(self): 880 def setUp(self):
876 super(TestDatabaseListField, self).setUp() 881 super(TestDatabaseListField, self).setUp()
@@ -893,12 +898,13 @@ class TestDatabaseListField(testtools.TestCase):
893 expected_error = "First symbol should be latin letter or underscore. "\ 898 expected_error = "First symbol should be latin letter or underscore. "\
894 "Subsequent symbols can be latin letter, numeric, "\ 899 "Subsequent symbols can be latin letter, numeric, "\
895 "underscore, at sign, number sign or dollar sign" 900 "underscore, at sign, number sign or dollar sign"
896 e = self.assertRaises(exceptions.ValidationError, 901 with self.assertRaises(exceptions.ValidationError) as cm:
897 self.database_list_field.validate, invalid_value) 902 self.database_list_field.validate(invalid_value)
903 e = cm.exception
898 self.assertEqual(expected_error, e.message) 904 self.assertEqual(expected_error, e.message)
899 905
900 906
901class TestErrorWidget(testtools.TestCase): 907class TestErrorWidget(unittest.TestCase):
902 908
903 def test_render(self): 909 def test_render(self):
904 error_widget = fields.ErrorWidget() 910 error_widget = fields.ErrorWidget()
diff --git a/muranodashboard/tests/unit/dynamic_ui/test_forms.py b/muranodashboard/tests/unit/dynamic_ui/test_forms.py
index d8f81ee..41cbc8a 100644
--- a/muranodashboard/tests/unit/dynamic_ui/test_forms.py
+++ b/muranodashboard/tests/unit/dynamic_ui/test_forms.py
@@ -14,7 +14,7 @@
14 14
15import collections 15import collections
16import mock 16import mock
17import testtools 17import unittest
18from yaql.language import contexts as yaql_contexts 18from yaql.language import contexts as yaql_contexts
19 19
20from django import forms as django_forms 20from django import forms as django_forms
@@ -24,7 +24,7 @@ from muranodashboard.dynamic_ui import forms
24from muranodashboard.dynamic_ui import yaql_expression 24from muranodashboard.dynamic_ui import yaql_expression
25 25
26 26
27class TestAnyFieldDict(testtools.TestCase): 27class TestAnyFieldDict(unittest.TestCase):
28 28
29 def test_missing(self): 29 def test_missing(self):
30 any_field_dict = forms.AnyFieldDict() 30 any_field_dict = forms.AnyFieldDict()
@@ -32,7 +32,7 @@ class TestAnyFieldDict(testtools.TestCase):
32 self.assertEqual('DynamicSelect', result.__name__) 32 self.assertEqual('DynamicSelect', result.__name__)
33 33
34 34
35class TestDynamicUiForm(testtools.TestCase): 35class TestDynamicUiForm(unittest.TestCase):
36 36
37 def test_collect_fields_process_widget(self): 37 def test_collect_fields_process_widget(self):
38 test_spec = { 38 test_spec = {
@@ -84,7 +84,7 @@ class TestDynamicUiForm(testtools.TestCase):
84 self.assertEqual(mock_yaql, field.validators[0]['expr'].spec) 84 self.assertEqual(mock_yaql, field.validators[0]['expr'].spec)
85 85
86 86
87class TestDynamicFormMetaclass(testtools.TestCase): 87class TestDynamicFormMetaclass(unittest.TestCase):
88 88
89 def test_new(self): 89 def test_new(self):
90 test_dict = { 90 test_dict = {
@@ -102,7 +102,7 @@ class TestDynamicFormMetaclass(testtools.TestCase):
102 fields.CharField) 102 fields.CharField)
103 103
104 104
105class TestUpdatableFieldsForm(testtools.TestCase): 105class TestUpdatableFieldsForm(unittest.TestCase):
106 106
107 def setUp(self): 107 def setUp(self):
108 super(TestUpdatableFieldsForm, self).setUp() 108 super(TestUpdatableFieldsForm, self).setUp()
@@ -141,7 +141,7 @@ class TestUpdatableFieldsForm(testtools.TestCase):
141 self.assertTrue(mock_password_field.update.called) 141 self.assertTrue(mock_password_field.update.called)
142 142
143 143
144class TestServiceConfigurationForm(testtools.TestCase): 144class TestServiceConfigurationForm(unittest.TestCase):
145 145
146 def setUp(self): 146 def setUp(self):
147 super(TestServiceConfigurationForm, self).setUp() 147 super(TestServiceConfigurationForm, self).setUp()
@@ -194,9 +194,10 @@ class TestServiceConfigurationForm(testtools.TestCase):
194 test_validator = {'expr': mock_expr, 'message': 'Foo Error'} 194 test_validator = {'expr': mock_expr, 'message': 'Foo Error'}
195 195
196 self.form.validators = [test_validator] 196 self.form.validators = [test_validator]
197 with self.assertRaisesRegex(django_forms.ValidationError, 197 with self.assertRaises(django_forms.ValidationError) as cm:
198 'Foo Error'):
199 self.form.clean() 198 self.form.clean()
199 e = cm.exception
200 self.assertIn('Foo Error', e.messages)
200 201
201 self.form.service.update_cleaned_data.assert_called_once_with( 202 self.form.service.update_cleaned_data.assert_called_once_with(
202 {'foo': 'bar', 'baz': 'qux'}, form=self.form) 203 {'foo': 'bar', 'baz': 'qux'}, form=self.form)
diff --git a/muranodashboard/tests/unit/dynamic_ui/test_helpers.py b/muranodashboard/tests/unit/dynamic_ui/test_helpers.py
index 4cf3651..1421319 100644
--- a/muranodashboard/tests/unit/dynamic_ui/test_helpers.py
+++ b/muranodashboard/tests/unit/dynamic_ui/test_helpers.py
@@ -12,12 +12,12 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14 14
15import testtools 15import unittest
16 16
17from muranodashboard.dynamic_ui import helpers 17from muranodashboard.dynamic_ui import helpers
18 18
19 19
20class TestHelper(testtools.TestCase): 20class TestHelper(unittest.TestCase):
21 def test_to_str(self): 21 def test_to_str(self):
22 names = ['string', b'ascii', u'ascii', 22 names = ['string', b'ascii', u'ascii',
23 u'\u043d\u0435 \u0430\u0441\u043a\u0438'] 23 u'\u043d\u0435 \u0430\u0441\u043a\u0438']
diff --git a/muranodashboard/tests/unit/dynamic_ui/test_versions.py b/muranodashboard/tests/unit/dynamic_ui/test_versions.py
index b46d02a..27fe245 100644
--- a/muranodashboard/tests/unit/dynamic_ui/test_versions.py
+++ b/muranodashboard/tests/unit/dynamic_ui/test_versions.py
@@ -12,12 +12,12 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14 14
15import testtools 15import unittest
16 16
17from muranodashboard.dynamic_ui import version 17from muranodashboard.dynamic_ui import version
18 18
19 19
20class TestVersions(testtools.TestCase): 20class TestVersions(unittest.TestCase):
21 def setUp(self): 21 def setUp(self):
22 super(TestVersions, self).setUp() 22 super(TestVersions, self).setUp()
23 self.original = version.LATEST_FORMAT_VERSION 23 self.original = version.LATEST_FORMAT_VERSION
diff --git a/muranodashboard/tests/unit/dynamic_ui/test_yaql_expression.py b/muranodashboard/tests/unit/dynamic_ui/test_yaql_expression.py
index abab071..4a75931 100644
--- a/muranodashboard/tests/unit/dynamic_ui/test_yaql_expression.py
+++ b/muranodashboard/tests/unit/dynamic_ui/test_yaql_expression.py
@@ -12,12 +12,12 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14 14
15import testtools 15import unittest
16 16
17from muranodashboard.dynamic_ui import yaql_expression 17from muranodashboard.dynamic_ui import yaql_expression
18 18
19 19
20class TestYaqlExpression(testtools.TestCase): 20class TestYaqlExpression(unittest.TestCase):
21 def setUp(self): 21 def setUp(self):
22 super(TestYaqlExpression, self).setUp() 22 super(TestYaqlExpression, self).setUp()
23 23
diff --git a/muranodashboard/tests/unit/dynamic_ui/test_yaql_functions.py b/muranodashboard/tests/unit/dynamic_ui/test_yaql_functions.py
index cf8f02c..7d8eaad 100644
--- a/muranodashboard/tests/unit/dynamic_ui/test_yaql_functions.py
+++ b/muranodashboard/tests/unit/dynamic_ui/test_yaql_functions.py
@@ -14,7 +14,7 @@
14 14
15import mock 15import mock
16import re 16import re
17import testtools 17import unittest
18 18
19from castellan.common import exception as castellan_exception 19from castellan.common import exception as castellan_exception
20from castellan.common.objects import opaque_data 20from castellan.common.objects import opaque_data
@@ -23,7 +23,7 @@ from muranodashboard.dynamic_ui import helpers
23from muranodashboard.dynamic_ui import yaql_functions 23from muranodashboard.dynamic_ui import yaql_functions
24 24
25 25
26class TestYAQLFunctions(testtools.TestCase): 26class TestYAQLFunctions(unittest.TestCase):
27 27
28 def test_generate_hostname(self): 28 def test_generate_hostname(self):
29 self.assertEqual( 29 self.assertEqual(
diff --git a/muranodashboard/tests/unit/environments/test_forms.py b/muranodashboard/tests/unit/environments/test_forms.py
index b25316c..8268007 100644
--- a/muranodashboard/tests/unit/environments/test_forms.py
+++ b/muranodashboard/tests/unit/environments/test_forms.py
@@ -13,7 +13,7 @@
13# under the License. 13# under the License.
14 14
15import mock 15import mock
16import testtools 16import unittest
17 17
18from django.utils.translation import ugettext_lazy as _ 18from django.utils.translation import ugettext_lazy as _
19 19
@@ -21,7 +21,7 @@ from muranoclient.common import exceptions as exc
21from muranodashboard.environments import forms as env_forms 21from muranodashboard.environments import forms as env_forms
22 22
23 23
24class TestCreateEnvForm(testtools.TestCase): 24class TestCreateEnvForm(unittest.TestCase):
25 def setUp(self): 25 def setUp(self):
26 super(TestCreateEnvForm, self).setUp() 26 super(TestCreateEnvForm, self).setUp()
27 self.mock_request = mock.MagicMock() 27 self.mock_request = mock.MagicMock()
diff --git a/muranodashboard/tests/unit/environments/test_tables.py b/muranodashboard/tests/unit/environments/test_tables.py
index 8c6b6ec..bfdb78a 100644
--- a/muranodashboard/tests/unit/environments/test_tables.py
+++ b/muranodashboard/tests/unit/environments/test_tables.py
@@ -15,7 +15,7 @@
15import ast 15import ast
16from django import http as django_http 16from django import http as django_http
17import mock 17import mock
18import testtools 18import unittest
19 19
20from horizon import tables as hz_tables 20from horizon import tables as hz_tables
21 21
@@ -25,7 +25,7 @@ from muranodashboard.environments import tables
25from muranodashboard.packages import consts as pkg_consts 25from muranodashboard.packages import consts as pkg_consts
26 26
27 27
28class TestEnvironmentTables(testtools.TestCase): 28class TestEnvironmentTables(unittest.TestCase):
29 def test_check_row_actions_allowed(self): 29 def test_check_row_actions_allowed(self):
30 actions = mock.Mock() 30 actions = mock.Mock()
31 actions.table.data = None 31 actions.table.data = None
@@ -359,7 +359,7 @@ class TestEnvironmentTables(testtools.TestCase):
359 self.assertEqual('foo_name', tables.get_service_type(test_datum)) 359 self.assertEqual('foo_name', tables.get_service_type(test_datum))
360 360
361 361
362class TestUpdateEnvironmentRow(testtools.TestCase): 362class TestUpdateEnvironmentRow(unittest.TestCase):
363 def setUp(self): 363 def setUp(self):
364 super(TestUpdateEnvironmentRow, self).setUp() 364 super(TestUpdateEnvironmentRow, self).setUp()
365 365
@@ -403,8 +403,10 @@ class TestUpdateEnvironmentRow(testtools.TestCase):
403 403
404 data_table = tables.UpdateEnvironmentRow(self.mock_data_table) 404 data_table = tables.UpdateEnvironmentRow(self.mock_data_table)
405 405
406 with self.assertRaisesRegex(django_http.Http404, None): 406 with self.assertRaises(django_http.Http404) as cm:
407 data_table.get_data(None, 'foo_environment_id') 407 data_table.get_data(None, 'foo_environment_id')
408 e = cm.exception
409 self.assertEqual('', str(e))
408 410
409 @mock.patch.object(tables, 'api') 411 @mock.patch.object(tables, 'api')
410 def test_get_data_except_exception(self, mock_api): 412 def test_get_data_except_exception(self, mock_api):
@@ -412,11 +414,13 @@ class TestUpdateEnvironmentRow(testtools.TestCase):
412 414
413 data_table = tables.UpdateEnvironmentRow(self.mock_data_table) 415 data_table = tables.UpdateEnvironmentRow(self.mock_data_table)
414 416
415 with self.assertRaisesRegex(Exception, 'foo_error'): 417 with self.assertRaises(Exception) as cm:
416 data_table.get_data(None, 'foo_environment_id') 418 data_table.get_data(None, 'foo_environment_id')
419 e = cm.exception
420 self.assertEqual('foo_error', str(e))
417 421
418 422
419class TestUpdateServiceRow(testtools.TestCase): 423class TestUpdateServiceRow(unittest.TestCase):
420 424
421 def setUp(self): 425 def setUp(self):
422 super(TestUpdateServiceRow, self).setUp() 426 super(TestUpdateServiceRow, self).setUp()
@@ -437,7 +441,7 @@ class TestUpdateServiceRow(testtools.TestCase):
437 None, 'foo_env_id', 'foo_service_id') 441 None, 'foo_env_id', 'foo_service_id')
438 442
439 443
440class TestUpdateEnvMetadata(testtools.TestCase): 444class TestUpdateEnvMetadata(unittest.TestCase):
441 445
442 def test_update_env_meta_data(self): 446 def test_update_env_meta_data(self):
443 kwargs = {'datum': 'foo_datum'} 447 kwargs = {'datum': 'foo_datum'}
@@ -508,7 +512,7 @@ class TestUpdateEnvMetadata(testtools.TestCase):
508 None, 'foo_env_id') 512 None, 'foo_env_id')
509 513
510 514
511class TestEnvironmentsTable(testtools.TestCase): 515class TestEnvironmentsTable(unittest.TestCase):
512 516
513 @mock.patch.object(tables, 'reverse') 517 @mock.patch.object(tables, 'reverse')
514 @mock.patch.object(tables, 'policy') 518 @mock.patch.object(tables, 'policy')
@@ -531,7 +535,7 @@ class TestEnvironmentsTable(testtools.TestCase):
531 "horizon:app-catalog:environments:services", args=('foo_env_id',)) 535 "horizon:app-catalog:environments:services", args=('foo_env_id',))
532 536
533 537
534class TestUpdateMetadata(testtools.TestCase): 538class TestUpdateMetadata(unittest.TestCase):
535 539
536 def setUp(self): 540 def setUp(self):
537 super(TestUpdateMetadata, self).setUp() 541 super(TestUpdateMetadata, self).setUp()
@@ -610,7 +614,7 @@ class TestUpdateMetadata(testtools.TestCase):
610 None, 'foo_env_id') 614 None, 'foo_env_id')
611 615
612 616
613class TestServicesTable(testtools.TestCase): 617class TestServicesTable(unittest.TestCase):
614 618
615 def test_get_object_id(self): 619 def test_get_object_id(self):
616 test_datum = {'?': {'id': 'foo'}} 620 test_datum = {'?': {'id': 'foo'}}
@@ -728,7 +732,7 @@ class TestServicesTable(testtools.TestCase):
728 'horizon:app-catalog:packages:index') 732 'horizon:app-catalog:packages:index')
729 733
730 734
731class TestShowDeploymentDetails(testtools.TestCase): 735class TestShowDeploymentDetails(unittest.TestCase):
732 736
733 @mock.patch.object(tables, 'reverse') 737 @mock.patch.object(tables, 'reverse')
734 def test_get_link_url(self, mock_reverse): 738 def test_get_link_url(self, mock_reverse):
@@ -750,7 +754,7 @@ class TestShowDeploymentDetails(testtools.TestCase):
750 self.assertTrue(show_deployment_details.allowed(None, None)) 754 self.assertTrue(show_deployment_details.allowed(None, None))
751 755
752 756
753class TestEnvConfigTable(testtools.TestCase): 757class TestEnvConfigTable(unittest.TestCase):
754 758
755 def test_get_object_id(self): 759 def test_get_object_id(self):
756 env_config_table = tables.EnvConfigTable(None) 760 env_config_table = tables.EnvConfigTable(None)
@@ -758,7 +762,7 @@ class TestEnvConfigTable(testtools.TestCase):
758 '?': {'id': 'foo'}})) 762 '?': {'id': 'foo'}}))
759 763
760 764
761class TestDeploymentHistoryTable(testtools.TestCase): 765class TestDeploymentHistoryTable(unittest.TestCase):
762 766
763 def setUp(self): 767 def setUp(self):
764 super(TestDeploymentHistoryTable, self).setUp() 768 super(TestDeploymentHistoryTable, self).setUp()
diff --git a/muranodashboard/tests/unit/environments/test_tabs.py b/muranodashboard/tests/unit/environments/test_tabs.py
index e891f40..17e37ac 100644
--- a/muranodashboard/tests/unit/environments/test_tabs.py
+++ b/muranodashboard/tests/unit/environments/test_tabs.py
@@ -14,7 +14,7 @@
14 14
15import collections 15import collections
16import mock 16import mock
17import testtools 17import unittest
18 18
19from django.conf import settings 19from django.conf import settings
20from django.utils.translation import ugettext_lazy as _ 20from django.utils.translation import ugettext_lazy as _
@@ -24,7 +24,7 @@ from muranodashboard.environments import tables
24from muranodashboard.environments import tabs 24from muranodashboard.environments import tabs
25 25
26 26
27class TestOverviewTab(testtools.TestCase): 27class TestOverviewTab(unittest.TestCase):
28 28
29 def setUp(self): 29 def setUp(self):
30 super(TestOverviewTab, self).setUp() 30 super(TestOverviewTab, self).setUp()
@@ -223,7 +223,7 @@ class TestOverviewTab(testtools.TestCase):
223 mock_heat_api.stacks_list.mock_calls) 223 mock_heat_api.stacks_list.mock_calls)
224 224
225 225
226class TestServiceLogsTab(testtools.TestCase): 226class TestServiceLogsTab(unittest.TestCase):
227 227
228 def setUp(self): 228 def setUp(self):
229 super(TestServiceLogsTab, self).setUp() 229 super(TestServiceLogsTab, self).setUp()
@@ -253,7 +253,7 @@ class TestServiceLogsTab(testtools.TestCase):
253 mock_request, 'foo_service_id', 'foo_environment_id') 253 mock_request, 'foo_service_id', 'foo_environment_id')
254 254
255 255
256class TestEnvLogsTab(testtools.TestCase): 256class TestEnvLogsTab(unittest.TestCase):
257 257
258 def setUp(self): 258 def setUp(self):
259 super(TestEnvLogsTab, self).setUp() 259 super(TestEnvLogsTab, self).setUp()
@@ -280,7 +280,7 @@ class TestEnvLogsTab(testtools.TestCase):
280 self.assertEqual({'reports': [mock_report]}, reports) 280 self.assertEqual({'reports': [mock_report]}, reports)
281 281
282 282
283class TestLatestLogTab(testtools.TestCase): 283class TestLatestLogTab(unittest.TestCase):
284 284
285 def test_allowed(self): 285 def test_allowed(self):
286 mock_request = mock.MagicMock() 286 mock_request = mock.MagicMock()
@@ -295,7 +295,7 @@ class TestLatestLogTab(testtools.TestCase):
295 self.assertEqual([mock_report], latest_logs_tab.allowed(mock_request)) 295 self.assertEqual([mock_report], latest_logs_tab.allowed(mock_request))
296 296
297 297
298class TestEnvConfigTab(testtools.TestCase): 298class TestEnvConfigTab(unittest.TestCase):
299 299
300 def setUp(self): 300 def setUp(self):
301 super(TestEnvConfigTab, self).setUp() 301 super(TestEnvConfigTab, self).setUp()
@@ -322,7 +322,7 @@ class TestEnvConfigTab(testtools.TestCase):
322 self.assertEqual(['foo_service'], result) 322 self.assertEqual(['foo_service'], result)
323 323
324 324
325class TestEnvironmentTopologyTab(testtools.TestCase): 325class TestEnvironmentTopologyTab(unittest.TestCase):
326 326
327 def setUp(self): 327 def setUp(self):
328 super(TestEnvironmentTopologyTab, self).setUp() 328 super(TestEnvironmentTopologyTab, self).setUp()
@@ -360,7 +360,7 @@ class TestEnvironmentTopologyTab(testtools.TestCase):
360 360
361 361
362@mock.patch.object(tabs, 'api') 362@mock.patch.object(tabs, 'api')
363class TestEnvironmentServicesTab(testtools.TestCase): 363class TestEnvironmentServicesTab(unittest.TestCase):
364 364
365 def setUp(self): 365 def setUp(self):
366 super(TestEnvironmentServicesTab, self).setUp() 366 super(TestEnvironmentServicesTab, self).setUp()
@@ -446,7 +446,7 @@ class TestEnvironmentServicesTab(testtools.TestCase):
446 446
447 447
448@mock.patch.object(tabs, 'api') 448@mock.patch.object(tabs, 'api')
449class TestDeploymentTab(testtools.TestCase): 449class TestDeploymentTab(unittest.TestCase):
450 450
451 def setUp(self): 451 def setUp(self):
452 super(TestDeploymentTab, self).setUp() 452 super(TestDeploymentTab, self).setUp()
@@ -511,7 +511,7 @@ class TestDeploymentTab(testtools.TestCase):
511 "horizon:app-catalog:environments:index") 511 "horizon:app-catalog:environments:index")
512 512
513 513
514class TestEnvironmentDetailsTabs(testtools.TestCase): 514class TestEnvironmentDetailsTabs(unittest.TestCase):
515 515
516 @mock.patch.object(tabs, 'api') 516 @mock.patch.object(tabs, 'api')
517 def test_init(self, mock_api): 517 def test_init(self, mock_api):
@@ -533,7 +533,7 @@ class TestEnvironmentDetailsTabs(testtools.TestCase):
533 self.assertTrue(env_details_tabs.sticky) 533 self.assertTrue(env_details_tabs.sticky)
534 534
535 535
536class TestServicesTabs(testtools.TestCase): 536class TestServicesTabs(unittest.TestCase):
537 537
538 def test_init(self): 538 def test_init(self):
539 mock_request = mock.Mock(GET={}) 539 mock_request = mock.Mock(GET={})
@@ -546,7 +546,7 @@ class TestServicesTabs(testtools.TestCase):
546 self.assertTrue(services_tabs.sticky) 546 self.assertTrue(services_tabs.sticky)
547 547
548 548
549class TestDeploymentDetailsTabs(testtools.TestCase): 549class TestDeploymentDetailsTabs(unittest.TestCase):
550 550
551 def test_init(self): 551 def test_init(self):
552 mock_request = mock.Mock(GET={}) 552 mock_request = mock.Mock(GET={})
diff --git a/muranodashboard/tests/unit/environments/test_views.py b/muranodashboard/tests/unit/environments/test_views.py
index 2fa73c9..8e14dd7 100644
--- a/muranodashboard/tests/unit/environments/test_views.py
+++ b/muranodashboard/tests/unit/environments/test_views.py
@@ -18,7 +18,7 @@ from django import http
18from django.utils.translation import ugettext_lazy as _ 18from django.utils.translation import ugettext_lazy as _
19import mock 19import mock
20import sys 20import sys
21import testtools 21import unittest
22 22
23from horizon import conf 23from horizon import conf
24 24
@@ -31,7 +31,7 @@ from muranodashboard.environments import views
31 31
32@mock.patch.object(views, 'exceptions') 32@mock.patch.object(views, 'exceptions')
33@mock.patch.object(views, 'api') 33@mock.patch.object(views, 'api')
34class TestIndexView(testtools.TestCase): 34class TestIndexView(unittest.TestCase):
35 35
36 def setUp(self): 36 def setUp(self):
37 super(TestIndexView, self).setUp() 37 super(TestIndexView, self).setUp()
@@ -72,7 +72,7 @@ class TestIndexView(testtools.TestCase):
72 self.index_view.request, ignore=True, escalate=True) 72 self.index_view.request, ignore=True, escalate=True)
73 73
74 74
75class TestEnvironmentDetails(testtools.TestCase): 75class TestEnvironmentDetails(unittest.TestCase):
76 76
77 def setUp(self): 77 def setUp(self):
78 super(TestEnvironmentDetails, self).setUp() 78 super(TestEnvironmentDetails, self).setUp()
@@ -159,7 +159,7 @@ class TestEnvironmentDetails(testtools.TestCase):
159 159
160 160
161@mock.patch.object(views, 'api') 161@mock.patch.object(views, 'api')
162class TestDetailServiceView(testtools.TestCase): 162class TestDetailServiceView(unittest.TestCase):
163 163
164 def setUp(self): 164 def setUp(self):
165 super(TestDetailServiceView, self).setUp() 165 super(TestDetailServiceView, self).setUp()
@@ -240,7 +240,7 @@ class TestDetailServiceView(testtools.TestCase):
240 self.assertIsInstance(result, env_tabs.ServicesTabs) 240 self.assertIsInstance(result, env_tabs.ServicesTabs)
241 241
242 242
243class TestCreateEnvironmentView(testtools.TestCase): 243class TestCreateEnvironmentView(unittest.TestCase):
244 244
245 def setUp(self): 245 def setUp(self):
246 super(TestCreateEnvironmentView, self).setUp() 246 super(TestCreateEnvironmentView, self).setUp()
@@ -303,7 +303,7 @@ class TestCreateEnvironmentView(testtools.TestCase):
303 303
304@mock.patch.object(views, 'reverse') 304@mock.patch.object(views, 'reverse')
305@mock.patch.object(views, 'api') 305@mock.patch.object(views, 'api')
306class TestDeploymentDetailsView(testtools.TestCase): 306class TestDeploymentDetailsView(unittest.TestCase):
307 307
308 def setUp(self): 308 def setUp(self):
309 super(TestDeploymentDetailsView, self).setUp() 309 super(TestDeploymentDetailsView, self).setUp()
@@ -422,7 +422,7 @@ class TestDeploymentDetailsView(testtools.TestCase):
422 self.assertIsInstance(result, env_tabs.DeploymentDetailsTabs) 422 self.assertIsInstance(result, env_tabs.DeploymentDetailsTabs)
423 423
424 424
425class TestJSONView(testtools.TestCase): 425class TestJSONView(unittest.TestCase):
426 426
427 @mock.patch.object(views, 'api') 427 @mock.patch.object(views, 'api')
428 def test_get(self, mock_api): 428 def test_get(self, mock_api):
@@ -438,7 +438,7 @@ class TestJSONView(testtools.TestCase):
438 'foo_env_id') 438 'foo_env_id')
439 439
440 440
441class TestJSONResponse(testtools.TestCase): 441class TestJSONResponse(unittest.TestCase):
442 442
443 def test_init(self): 443 def test_init(self):
444 kwargs = {'content_type': 'json'} 444 kwargs = {'content_type': 'json'}
@@ -451,7 +451,7 @@ class TestJSONResponse(testtools.TestCase):
451 self.assertEqual(b'"foo"', json_response.content) 451 self.assertEqual(b'"foo"', json_response.content)
452 452
453 453
454class TestStartActionView(testtools.TestCase): 454class TestStartActionView(unittest.TestCase):
455 455
456 @mock.patch.object(views, 'reverse') 456 @mock.patch.object(views, 'reverse')
457 @mock.patch.object(views, 'api') 457 @mock.patch.object(views, 'api')
@@ -475,7 +475,7 @@ class TestStartActionView(testtools.TestCase):
475 mock_api.action_allowed.assert_called_with(mock_request, 'foo_env_id') 475 mock_api.action_allowed.assert_called_with(mock_request, 'foo_env_id')
476 476
477 477
478class TestActionResultView(testtools.TestCase): 478class TestActionResultView(unittest.TestCase):
479 479
480 def test_is_file_returned(self): 480 def test_is_file_returned(self):
481 test_result = {'result': {'?': {'type': 'io.murano.File'}}} 481 test_result = {'result': {'?': {'type': 'io.murano.File'}}}
@@ -568,7 +568,7 @@ class TestActionResultView(testtools.TestCase):
568 assert_called_once_with('foo_env_id', 'foo_task_id') 568 assert_called_once_with('foo_env_id', 'foo_task_id')
569 569
570 570
571class TestDeploymentHistoryView(testtools.TestCase): 571class TestDeploymentHistoryView(unittest.TestCase):
572 572
573 def setUp(self): 573 def setUp(self):
574 super(TestDeploymentHistoryView, self).setUp() 574 super(TestDeploymentHistoryView, self).setUp()
diff --git a/muranodashboard/tests/unit/images/test_forms.py b/muranodashboard/tests/unit/images/test_forms.py
index 09d4faf..bfa6475 100644
--- a/muranodashboard/tests/unit/images/test_forms.py
+++ b/muranodashboard/tests/unit/images/test_forms.py
@@ -13,14 +13,14 @@
13# under the License. 13# under the License.
14 14
15import mock 15import mock
16import testtools 16import unittest
17 17
18from django.utils.translation import ugettext_lazy as _ 18from django.utils.translation import ugettext_lazy as _
19 19
20from muranodashboard.images import forms 20from muranodashboard.images import forms
21 21
22 22
23class TestImagesForms(testtools.TestCase): 23class TestImagesForms(unittest.TestCase):
24 def setUp(self): 24 def setUp(self):
25 super(TestImagesForms, self).setUp() 25 super(TestImagesForms, self).setUp()
26 metadata = '{"title": "title", "type": "type"}' 26 metadata = '{"title": "title", "type": "type"}'
@@ -49,7 +49,7 @@ class TestImagesForms(testtools.TestCase):
49 forms.filter_murano_images(images, self.mock_request)) 49 forms.filter_murano_images(images, self.mock_request))
50 50
51 51
52class TestMarkImageForm(testtools.TestCase): 52class TestMarkImageForm(unittest.TestCase):
53 def setUp(self): 53 def setUp(self):
54 super(TestMarkImageForm, self).setUp() 54 super(TestMarkImageForm, self).setUp()
55 self.mock_request = mock.MagicMock() 55 self.mock_request = mock.MagicMock()
diff --git a/muranodashboard/tests/unit/images/test_views.py b/muranodashboard/tests/unit/images/test_views.py
index b9826bc..1cc0407 100644
--- a/muranodashboard/tests/unit/images/test_views.py
+++ b/muranodashboard/tests/unit/images/test_views.py
@@ -14,7 +14,7 @@
14 14
15import json 15import json
16import mock 16import mock
17import testtools 17import unittest
18 18
19from horizon import exceptions 19from horizon import exceptions
20 20
@@ -22,7 +22,7 @@ from muranodashboard.images import tables
22from muranodashboard.images import views 22from muranodashboard.images import views
23 23
24 24
25class TestMarkedImagesView(testtools.TestCase): 25class TestMarkedImagesView(unittest.TestCase):
26 26
27 def setUp(self): 27 def setUp(self):
28 super(TestMarkedImagesView, self).setUp() 28 super(TestMarkedImagesView, self).setUp()
@@ -170,7 +170,9 @@ class TestMarkedImagesView(testtools.TestCase):
170 mock_reverse.return_value = 'foo_reverse_url' 170 mock_reverse.return_value = 'foo_reverse_url'
171 self.images_view.request.GET.get.return_value = None 171 self.images_view.request.GET.get.return_value = None
172 172
173 e = self.assertRaises(exceptions.Http302, self.images_view.get_data) 173 with self.assertRaises(exceptions.Http302) as cm:
174 self.images_view.get_data()
175 e = cm.exception
174 self.assertEqual('foo_reverse_url', e.location) 176 self.assertEqual('foo_reverse_url', e.location)
175 177
176 mock_glance.glanceclient.assert_called_once_with( 178 mock_glance.glanceclient.assert_called_once_with(
diff --git a/muranodashboard/tests/unit/packages/test_tables.py b/muranodashboard/tests/unit/packages/test_tables.py
index edb617f..b4f9392 100644
--- a/muranodashboard/tests/unit/packages/test_tables.py
+++ b/muranodashboard/tests/unit/packages/test_tables.py
@@ -13,7 +13,7 @@
13# under the License. 13# under the License.
14 14
15import mock 15import mock
16import testtools 16import unittest
17 17
18from django.utils.translation import ugettext_lazy as _ 18from django.utils.translation import ugettext_lazy as _
19 19
@@ -21,7 +21,7 @@ from muranoclient.common import exceptions as exc
21from muranodashboard.packages import tables 21from muranodashboard.packages import tables
22 22
23 23
24class TestImportPackage(testtools.TestCase): 24class TestImportPackage(unittest.TestCase):
25 25
26 def setUp(self): 26 def setUp(self):
27 super(TestImportPackage, self).setUp() 27 super(TestImportPackage, self).setUp()
@@ -47,7 +47,7 @@ class TestImportPackage(testtools.TestCase):
47 self.assertFalse(self.import_package.allowed(None, None)) 47 self.assertFalse(self.import_package.allowed(None, None))
48 48
49 49
50class TestDownloadPackage(testtools.TestCase): 50class TestDownloadPackage(unittest.TestCase):
51 51
52 def setUp(self): 52 def setUp(self):
53 super(TestDownloadPackage, self).setUp() 53 super(TestDownloadPackage, self).setUp()
@@ -79,7 +79,7 @@ class TestDownloadPackage(testtools.TestCase):
79 args=('foo-app', 'foo_app_id')) 79 args=('foo-app', 'foo_app_id'))
80 80
81 81
82class TestToggleEnabled(testtools.TestCase): 82class TestToggleEnabled(unittest.TestCase):
83 83
84 def setUp(self): 84 def setUp(self):
85 super(TestToggleEnabled, self).setUp() 85 super(TestToggleEnabled, self).setUp()
@@ -142,7 +142,7 @@ class TestToggleEnabled(testtools.TestCase):
142 'horizon:app-catalog:packages:index') 142 'horizon:app-catalog:packages:index')
143 143
144 144
145class TestTogglePublicEnabled(testtools.TestCase): 145class TestTogglePublicEnabled(unittest.TestCase):
146 146
147 def setUp(self): 147 def setUp(self):
148 super(TestTogglePublicEnabled, self).setUp() 148 super(TestTogglePublicEnabled, self).setUp()
@@ -231,7 +231,7 @@ class TestTogglePublicEnabled(testtools.TestCase):
231 'horizon:app-catalog:packages:index') 231 'horizon:app-catalog:packages:index')
232 232
233 233
234class TestDeletePackage(testtools.TestCase): 234class TestDeletePackage(unittest.TestCase):
235 235
236 def setUp(self): 236 def setUp(self):
237 super(TestDeletePackage, self).setUp() 237 super(TestDeletePackage, self).setUp()
@@ -330,7 +330,7 @@ class TestDeletePackage(testtools.TestCase):
330 'horizon:app-catalog:packages:index') 330 'horizon:app-catalog:packages:index')
331 331
332 332
333class TestModifyPackage(testtools.TestCase): 333class TestModifyPackage(unittest.TestCase):
334 334
335 def setUp(self): 335 def setUp(self):
336 super(TestModifyPackage, self).setUp() 336 super(TestModifyPackage, self).setUp()
diff --git a/test-requirements.txt b/test-requirements.txt
index 5499352..47bf4d6 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,14 +4,9 @@
4hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 4hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
5 5
6coverage!=4.4,>=4.0 # Apache-2.0 6coverage!=4.4,>=4.0 # Apache-2.0
7django-nose>=1.4.4 # BSD
8nose>=1.3.7 # LGPL
9oslo.config>=5.2.0 # Apache-2.0 7oslo.config>=5.2.0 # Apache-2.0
10openstack.nose-plugin>=0.7 # Apache-2.0
11nosehtmloutput>=0.0.3 # Apache-2.0
12selenium>=2.50.1 # Apache-2.0 8selenium>=2.50.1 # Apache-2.0
13 9
14testtools>=2.2.0 # MIT
15mock>=2.0.0 # BSD 10mock>=2.0.0 # BSD
16 11
17# Docs Requirements 12# Docs Requirements
diff --git a/tox.ini b/tox.ini
index 42908d0..1564970 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,11 +6,6 @@ skipsdist = True
6[testenv] 6[testenv]
7usedevelop = True 7usedevelop = True
8setenv = VIRTUAL_ENV={envdir} 8setenv = VIRTUAL_ENV={envdir}
9 NOSE_WITH_OPENSTACK=1
10 NOSE_OPENSTACK_COLOR=1
11 NOSE_OPENSTACK_RED=0.05
12 NOSE_OPENSTACK_YELLOW=0.025
13 NOSE_OPENSTACK_SHOW_ELAPSED=1
14 DJANGO_SETTINGS_MODULE=muranodashboard.tests.settings 9 DJANGO_SETTINGS_MODULE=muranodashboard.tests.settings
15passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY 10passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
16deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} 11deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
@@ -68,6 +63,8 @@ commands =
68 pybabel extract -F babel-djangojs.cfg -o muranodashboard/locale/djangojs.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 muranodashboard 63 pybabel extract -F babel-djangojs.cfg -o muranodashboard/locale/djangojs.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 muranodashboard
69 64
70[flake8] 65[flake8]
66# H202: assertRaises Exception too broad
67ignore = H202
71show-source = true 68show-source = true
72builtins = _ 69builtins = _
73exclude=build,.git,.tox,dist,doc,*lib/python*,*egg,tools,horizon,settings.py,*/local/*,functional_tests,node_modules 70exclude=build,.git,.tox,dist,doc,*lib/python*,*egg,tools,horizon,settings.py,*/local/*,functional_tests,node_modules