Upgrade to django 1.7
Fixed a number of issues that were revealed by migrating to django 1.7, which is the current version used by horizon and global requirements: - Use standard decorator for skipping tests - Avoid duplicate django application labels with projects dashboard by specifying a default AppConfig with a custom label - Avoid unnecessary use of obsoleted insert() on fields in share network create form
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -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'
|
||||
|
31
manila_ui/dashboards/project/config.py
Normal file
31
manila_ui/dashboards/project/config.py
Normal file
@@ -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'
|
@@ -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 = [
|
||||
|
@@ -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])
|
||||
|
@@ -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
|
@@ -55,7 +55,6 @@ INSTALLED_APPS = (
|
||||
'horizon',
|
||||
'openstack_dashboard',
|
||||
'openstack_dashboard.dashboards',
|
||||
'manila_ui.dashboards',
|
||||
)
|
||||
|
||||
AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',)
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user