diff --git a/manila_ui/dashboards/admin/shares/tests.py b/manila_ui/dashboards/admin/shares/tests.py index baad75c6..cd93baee 100644 --- a/manila_ui/dashboards/admin/shares/tests.py +++ b/manila_ui/dashboards/admin/shares/tests.py @@ -14,10 +14,10 @@ from django.core.urlresolvers import reverse import mock +import unittest from manila_ui.api import manila as api_manila from manila_ui.dashboards.project.shares import test_data -from manila_ui.test import decorators from manila_ui.test import helpers as test from openstack_dashboard import api @@ -57,7 +57,7 @@ class SharesTests(test.BaseAdminViewTests): self.assertEqual(res.status_code, 200) self.assertTemplateUsed(res, 'admin/shares/index.html') - @decorators.skip_broken_test() + @unittest.skip("broken unit test") def test_delete_share(self): share = test_data.share diff --git a/manila_ui/dashboards/project/__init__.py b/manila_ui/dashboards/project/__init__.py index e69de29b..4d50a67c 100644 --- a/manila_ui/dashboards/project/__init__.py +++ b/manila_ui/dashboards/project/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# Specify a custom application configuration. The comments in that class give +# more background about why this is needed. +default_app_config = 'manila_ui.dashboards.project.config.Config' diff --git a/manila_ui/dashboards/project/config.py b/manila_ui/dashboards/project/config.py new file mode 100644 index 00000000..6fd1b426 --- /dev/null +++ b/manila_ui/dashboards/project/config.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# +# Starting with Django 1.7, when a django app is loaded, it is assigned a +# default label containing the portion of the application name after the last +# period, and this name has to be globally unique. When horizon project +# dashboard, openstack_dashboard.dashboards.project, is loaded, it is assigned +# the label 'project'. But when the manila dashboard +# manila_ui.dashboards.project is loaded, it label will conflict with +# horizon's. Therefore this AppConfig class exists merely to specify a unique +# configuration label and avoid this conflict. +# + +from django.apps import AppConfig + + +class Config(AppConfig): + name = 'manila_ui.dashboards.project' + label = 'manila_project' diff --git a/manila_ui/dashboards/project/shares/share_networks/forms.py b/manila_ui/dashboards/project/shares/share_networks/forms.py index 1dfd2270..2fbbb2ce 100644 --- a/manila_ui/dashboards/project/shares/share_networks/forms.py +++ b/manila_ui/dashboards/project/shares/share_networks/forms.py @@ -60,9 +60,7 @@ class Create(forms.SelfHandlingForm): 'data-switch-on': 'net', 'data-net-%s' % net.id: _("Neutron Subnet") })) - # Insert subnet choice field under network choice field - # (before Description field that has index 3) - self.fields.insert(3, subnet_field_name, subnet_field) + self.fields[subnet_field_name] = subnet_field subnet_choices = neutron.subnet_list( request, network_id=net.id) self.fields[subnet_field_name].choices = [ diff --git a/manila_ui/dashboards/project/shares/shares/tests.py b/manila_ui/dashboards/project/shares/shares/tests.py index b6f530c5..e3bfd518 100644 --- a/manila_ui/dashboards/project/shares/shares/tests.py +++ b/manila_ui/dashboards/project/shares/shares/tests.py @@ -14,10 +14,10 @@ from django.core.urlresolvers import reverse import mock +import unittest from manila_ui.api import manila as api_manila from manila_ui.dashboards.project.shares import test_data -from manila_ui.test import decorators from manila_ui.test import helpers as test from openstack_dashboard import api @@ -28,7 +28,7 @@ SHARE_INDEX_URL = reverse('horizon:project:shares:index') class ShareViewTests(test.TestCase): - @decorators.skip_broken_test() + @unittest.skip("broken unit test") def test_create_share(self): usage_limit = {'maxTotalVolumeGigabytes': 250, 'gigabytesUsed': 20, @@ -57,7 +57,7 @@ class ShareViewTests(test.TestCase): formData['description'], formData['type'], snapshot_id=None, share_network_id=share_net.id, metadata={}) - @decorators.skip_broken_test() + @unittest.skip("broken unit test") def test_create_share_from_snapshot(self): share_net = test_data.active_share_network share_nets = [share_net] @@ -88,7 +88,7 @@ class ShareViewTests(test.TestCase): share_network_id=share_net.id, metadata={}) self.assertRedirectsNoFollow(res, SHARE_INDEX_URL) - @decorators.skip_broken_test() + @unittest.skip("broken unit test") def test_create_share_from_snapshot_url(self): share_net = test_data.active_share_network share_nets = [share_net] @@ -115,7 +115,7 @@ class ShareViewTests(test.TestCase): formData['description'], formData['type'], snapshot_id=None, share_network_id=share_net.id, metadata={}) - @decorators.skip_broken_test() + @unittest.skip("broken unit test") def test_delete_share(self): share = test_data.share @@ -184,7 +184,7 @@ class ShareViewTests(test.TestCase): self.assertEqual(res.status_code, 200) self.assertTemplateUsed(res, 'project/shares/shares/manage_rules.html') - @decorators.skip_broken_test() + @unittest.skip("broken unit test") def test_create_rule(self): share = test_data.share url = reverse('horizon:project:shares:rule_add', args=[share.id]) diff --git a/manila_ui/test/decorators.py b/manila_ui/test/decorators.py deleted file mode 100644 index 9624c9d0..00000000 --- a/manila_ui/test/decorators.py +++ /dev/null @@ -1,47 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -import inspect - -import openstack_dashboard.test.integration_tests.tests.decorators \ - as os_decorators - - -def skip_broken_test(): - """Decorator for skipping broken tests - - Usage: - from manila_ui.test import decorators - - class TestDashboardHelp(helpers.TestCase): - - @decorators.skip_broken_test() - def test_dashboard_help_redirection(self): - . - . - . - """ - - def actual_decoration(obj): - if inspect.isclass(obj): - if not os_decorators._is_test_cls(obj): - raise ValueError(os_decorators.NOT_TEST_OBJECT_ERROR_MSG) - skip_method = os_decorators._mark_class_skipped - else: - if not os_decorators._is_test_method_name(obj.func_name): - raise ValueError(os_decorators.NOT_TEST_OBJECT_ERROR_MSG) - skip_method = os_decorators._mark_method_skipped - - obj = skip_method(obj, "Skipped broken test") - return obj - return actual_decoration diff --git a/manila_ui/test/settings.py b/manila_ui/test/settings.py index 6f47bc55..85d1f617 100644 --- a/manila_ui/test/settings.py +++ b/manila_ui/test/settings.py @@ -55,7 +55,6 @@ INSTALLED_APPS = ( 'horizon', 'openstack_dashboard', 'openstack_dashboard.dashboards', - 'manila_ui.dashboards', ) AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',) diff --git a/requirements.txt b/requirements.txt index fd71be0f..fb51bc11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ pbr>=0.6,!=0.7,<1.0 # Horizon Core Requirements Babel>=1.3 -Django>=1.4.2,<1.7 +Django>=1.4.2,<1.8 django_compressor>=1.4 django_openstack_auth>=1.1.7,!=1.1.8 iso8601>=0.1.9