Updating hacking to 0.9.2 and associated styling fixes

Change-Id: Ibda11466db47e040ce3629d4290706488db831ce
This commit is contained in:
Lennart Regebro 2014-10-01 11:26:45 +02:00
parent b0506f09d8
commit 9242e1f40b
51 changed files with 91 additions and 114 deletions

View File

@ -6,7 +6,7 @@ set -o errexit
# Increment me any time the environment should be rebuilt. # Increment me any time the environment should be rebuilt.
# This includes dependency changes, directory renames, etc. # This includes dependency changes, directory renames, etc.
# Simple integer sequence: 1, 2, 3... # Simple integer sequence: 1, 2, 3...
environment_version=44 environment_version=45
#--------------------------------------------------------# #--------------------------------------------------------#
function usage { function usage {

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8 # Hacking already pins down pep8, pyflakes and flake8
hacking>=0.8.0,<0.9 hacking>=0.9.2,<0.10
# Testing Requirements # Testing Requirements
coverage>=3.6 coverage>=3.6
django-nose django-nose

View File

@ -15,10 +15,8 @@ import urlparse
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions
from horizon.utils import memoized from horizon.utils import memoized
from openstack_dashboard.api import base from openstack_dashboard.api import base
from openstack_dashboard.api import heat from openstack_dashboard.api import heat
from openstack_dashboard.api import keystone from openstack_dashboard.api import keystone
@ -131,9 +129,9 @@ class Stack(base.APIResourceWrapper):
""" """
# TODO(lsmola) until we have working deployment through Tuskar-API, # TODO(lsmola) until we have working deployment through Tuskar-API,
# this will not work # this will not work
#for stack in Stack.list(request): # for stack in Stack.list(request):
# if stack.plan and (stack.plan.id == plan.id): # if stack.plan and (stack.plan.id == plan.id):
# return stack # return stack
try: try:
stack = Stack.list(request)[0] stack = Stack.list(request)[0]
except IndexError: except IndexError:
@ -149,8 +147,10 @@ class Stack(base.APIResourceWrapper):
@memoized.memoized @memoized.memoized
def resources(self, with_joins=True, role=None): def resources(self, with_joins=True, role=None):
"""Return list of OS::Nova::Server Resources associated with the Stack """Return list of OS::Nova::Server Resources
and which are associated with a Role
Return list of OS::Nova::Server Resources associated with the Stack
and which are associated with a Role
:param with_joins: should we also retrieve objects associated with each :param with_joins: should we also retrieve objects associated with each
retrieved Resource? retrieved Resource?
@ -228,8 +228,7 @@ class Stack(base.APIResourceWrapper):
@cached_property @cached_property
def plan(self): def plan(self):
"""return associated Plan if a plan_id exists within stack """return associated Plan if a plan_id exists within stack parameters.
parameters.
:return: associated Plan if plan_id exists and a matching plan :return: associated Plan if plan_id exists and a matching plan
exists as well; None otherwise exists as well; None otherwise
@ -238,9 +237,9 @@ class Stack(base.APIResourceWrapper):
# TODO(lsmola) replace this by actual reference, I am pretty sure # TODO(lsmola) replace this by actual reference, I am pretty sure
# the relation won't be stored in parameters, that would mean putting # the relation won't be stored in parameters, that would mean putting
# that into template, which doesn't make sense # that into template, which doesn't make sense
#if 'plan_id' in self.parameters: # if 'plan_id' in self.parameters:
# return tuskar.Plan.get(self._request, # return tuskar.Plan.get(self._request,
# self.parameters['plan_id']) # self.parameters['plan_id'])
try: try:
plan = tuskar.Plan.list(self._request)[0] plan = tuskar.Plan.list(self._request)[0]
except IndexError: except IndexError:

View File

@ -75,8 +75,7 @@ class IronicNode(base.APIResourceWrapper):
memory_mb=None, local_gb=None, mac_addresses=[], memory_mb=None, local_gb=None, mac_addresses=[],
ipmi_username=None, ipmi_password=None, ssh_address=None, ipmi_username=None, ipmi_password=None, ssh_address=None,
ssh_username=None, ssh_key_contents=None, driver=None): ssh_username=None, ssh_key_contents=None, driver=None):
"""Create a Node in Ironic """Create a Node in Ironic."""
"""
if driver == 'pxe_ssh': if driver == 'pxe_ssh':
driver_info = { driver_info = {
'ssh_address': ssh_address, 'ssh_address': ssh_address,
@ -177,7 +176,9 @@ class IronicNode(base.APIResourceWrapper):
@classmethod @classmethod
def delete(cls, request, uuid): def delete(cls, request, uuid):
"""Remove the IronicNode matching the ID if it """Delete an IronicNode
Remove the IronicNode matching the ID if it
exists; otherwise, does nothing. exists; otherwise, does nothing.
:param request: request object :param request: request object
@ -275,8 +276,7 @@ class BareMetalNode(base.APIResourceWrapper):
local_gb, mac_addresses, ipmi_username=None, ipmi_password=None, local_gb, mac_addresses, ipmi_username=None, ipmi_password=None,
ssh_address=None, ssh_username=None, ssh_key_contents=None, ssh_address=None, ssh_username=None, ssh_key_contents=None,
driver=None): driver=None):
"""Create a Nova BareMetalNode """Create a Nova BareMetalNode."""
"""
node = baremetalclient(request).create( node = baremetalclient(request).create(
service_host='undercloud', service_host='undercloud',
cpus=cpus, cpus=cpus,
@ -402,8 +402,7 @@ class BareMetalNode(base.APIResourceWrapper):
@cached_property @cached_property
def driver(self): def driver(self):
"""Return driver for this BareMetalNode """Return driver for this BareMetalNode."""
"""
return "IPMI + PXE" return "IPMI + PXE"
@cached_property @cached_property

View File

@ -21,6 +21,7 @@ from openstack_dashboard.api import base
from openstack_dashboard.api import glance from openstack_dashboard.api import glance
from openstack_dashboard.api import neutron from openstack_dashboard.api import neutron
from os_cloud_config import keystone_pki from os_cloud_config import keystone_pki
from tuskarclient import client as tuskar_client from tuskarclient import client as tuskar_client
from tuskar_ui.api import flavor from tuskar_ui.api import flavor
@ -387,8 +388,7 @@ class Role(base.APIResourceWrapper):
@classmethod @classmethod
@handle_errors(_("Unable to retrieve overcloud role")) @handle_errors(_("Unable to retrieve overcloud role"))
def get_by_image(cls, request, plan, image): def get_by_image(cls, request, plan, image):
"""Return the Tuskar Role whose ImageID """Return the Role whose ImageID parameter matches the image.
parameter matches the passed in image
:param request: request object :param request: request object
:type request: django.http.HttpRequest :type request: django.http.HttpRequest

View File

@ -47,7 +47,9 @@
# So we have a copy of it here, with the bug fixed. # So we have a copy of it here, with the bug fixed.
# FIXME: Use django's version when the bug is fixed there. # FIXME: Use django's version when the bug is fixed there.
class cached_property(object): class cached_property(object):
"""Decorator that creates converts a method with a single self argument """Cached property decorator.
Decorator that creates converts a method with a single self argument
into a property cached on the instance. into a property cached on the instance.
""" """

View File

@ -12,6 +12,7 @@
# under the License. # under the License.
from openstack_dashboard import exceptions from openstack_dashboard import exceptions
from tuskarclient.openstack.common.apiclient import exceptions as tuskarclient from tuskarclient.openstack.common.apiclient import exceptions as tuskarclient
NOT_FOUND = exceptions.NOT_FOUND NOT_FOUND = exceptions.NOT_FOUND

View File

@ -16,7 +16,6 @@ import re
from django import forms from django import forms
from django.utils import html from django.utils import html
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import netaddr import netaddr
@ -119,10 +118,12 @@ class SelfHandlingFormset(forms.formsets.BaseFormSet):
class LabelWidget(forms.Widget): class LabelWidget(forms.Widget):
"""This is a custom widget to show context information just as text, """A widget for displaying information.
as readonly inputs are confusing.
Note that the field also must be required=False, as no input This is a custom widget to show context information just as text,
is rendered, and it must be ignored in the handle() method. as readonly inputs are confusing.
Note that the field also must be required=False, as no input
is rendered, and it must be ignored in the handle() method.
""" """
def render(self, name, value, attrs=None): def render(self, name, value, attrs=None):
if value: if value:

View File

@ -12,7 +12,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from tuskar_ui.infrastructure import dashboard from tuskar_ui.infrastructure import dashboard

View File

@ -14,9 +14,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from openstack_dashboard.dashboards.admin.flavors import (
from openstack_dashboard.dashboards.admin.flavors \ tables as flavor_tables)
import tables as flavor_tables
from tuskar_ui import api from tuskar_ui import api

View File

@ -15,13 +15,11 @@
import contextlib import contextlib
from django.core import urlresolvers from django.core import urlresolvers
from mock import patch, call # noqa
from novaclient.v1_1 import servers
from horizon import exceptions from horizon import exceptions
from mock import patch, call # noqa
from novaclient.v1_1 import servers
from openstack_dashboard.test.test_data import utils from openstack_dashboard.test.test_data import utils
from tuskar_ui import api from tuskar_ui import api
from tuskar_ui.test import helpers as test from tuskar_ui.test import helpers as test
from tuskar_ui.test.test_data import flavor_data from tuskar_ui.test.test_data import flavor_data
@ -110,7 +108,7 @@ class FlavorsTest(test.BaseAdminViewTests):
self.client.get(CREATE_URL) self.client.get(CREATE_URL)
# FIXME(tzumainn): I expected the following to work, seems similar # FIXME(tzumainn): I expected the following to work, seems similar
# to comment on test_index_recoverable_failure # to comment on test_index_recoverable_failure
#self.assertMessageCount(error=1, warning=0) # self.assertMessageCount(error=1, warning=0)
def test_create_post_ok(self): def test_create_post_ok(self):
images = TEST_DATA.glanceclient_images.list() images = TEST_DATA.glanceclient_images.list()

View File

@ -14,7 +14,6 @@
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon.exceptions import horizon.exceptions
import horizon.tables import horizon.tables
import horizon.tabs import horizon.tabs

View File

@ -14,13 +14,12 @@
from django.forms import fields from django.forms import fields
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions
from horizon import workflows from horizon import workflows
from openstack_dashboard.api import glance from openstack_dashboard.api import glance
from openstack_dashboard.dashboards.admin.flavors \ from openstack_dashboard.dashboards.admin.flavors import (
import workflows as flavor_workflows workflows as flavor_workflows)
from tuskar_ui import api from tuskar_ui import api

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from tuskar_ui.infrastructure import dashboard from tuskar_ui.infrastructure import dashboard

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables

View File

@ -15,10 +15,9 @@
import contextlib import contextlib
from django.core import urlresolvers from django.core import urlresolvers
from mock import patch, call # noqa from mock import patch, call # noqa
from openstack_dashboard.test.test_data import utils from openstack_dashboard.test.test_data import utils
from tuskar_ui import api from tuskar_ui import api
from tuskar_ui.test import helpers as test from tuskar_ui.test import helpers as test
from tuskar_ui.test.test_data import heat_data from tuskar_ui.test.test_data import heat_data

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from tuskar_ui.infrastructure import dashboard from tuskar_ui.infrastructure import dashboard

View File

@ -13,12 +13,10 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from openstack_dashboard import api from openstack_dashboard import api
from openstack_dashboard.dashboards.project.images.images \ from openstack_dashboard.dashboards.project.images.images import (
import tables as project_tables tables as project_tables)
class CreateImage(project_tables.CreateImage): class CreateImage(project_tables.CreateImage):

View File

@ -14,11 +14,10 @@
import contextlib import contextlib
import json import json
import mock import mock
from mock import patch, call # noqa from mock import patch, call # noqa
from django.core import urlresolvers from django.core import urlresolvers
from openstack_dashboard.dashboards.project.images.images import forms from openstack_dashboard.dashboards.project.images.images import forms
from tuskar_ui import api from tuskar_ui import api

View File

@ -16,11 +16,9 @@ import logging
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions
from horizon import tables as horizon_tables from horizon import tables as horizon_tables
from horizon.utils import memoized from horizon.utils import memoized
from openstack_dashboard import api from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.images import views as admin_views from openstack_dashboard.dashboards.admin.images import views as admin_views
from openstack_dashboard.dashboards.project.images.images import views from openstack_dashboard.dashboards.project.images.images import views

View File

@ -13,11 +13,12 @@
# under the License. # under the License.
import csv import csv
import django.forms import django.forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions
from horizon import forms from horizon import forms
from tuskar_ui import api from tuskar_ui import api
import tuskar_ui.forms import tuskar_ui.forms

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from tuskar_ui.infrastructure import dashboard from tuskar_ui.infrastructure import dashboard

View File

@ -14,7 +14,6 @@
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from tuskar_ui import api from tuskar_ui import api

View File

@ -14,10 +14,8 @@
from django.core import urlresolvers from django.core import urlresolvers
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions
from horizon import tabs from horizon import tabs
from openstack_dashboard.api import base as api_base from openstack_dashboard.api import base as api_base
from tuskar_ui import api from tuskar_ui import api

View File

@ -16,12 +16,11 @@ import contextlib
import json import json
from django.core import urlresolvers from django.core import urlresolvers
from mock import patch, call # noqa
from horizon import exceptions as horizon_exceptions from horizon import exceptions as horizon_exceptions
from mock import patch, call # noqa
from openstack_dashboard.test import helpers from openstack_dashboard.test import helpers
from openstack_dashboard.test.test_data import utils from openstack_dashboard.test.test_data import utils
from tuskar_ui import api from tuskar_ui import api
from tuskar_ui.handle_errors import handle_errors # noqa from tuskar_ui.handle_errors import handle_errors # noqa
from tuskar_ui.test import helpers as test from tuskar_ui.test import helpers as test

View File

@ -17,7 +17,6 @@ from django.core.urlresolvers import reverse_lazy
from django import http from django import http
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import base from django.views.generic import base
from horizon import forms as horizon_forms from horizon import forms as horizon_forms
from horizon import tabs as horizon_tabs from horizon import tabs as horizon_tabs
from horizon.utils import memoized from horizon.utils import memoized

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from tuskar_ui.infrastructure import dashboard from tuskar_ui.infrastructure import dashboard

View File

@ -25,7 +25,9 @@ INDEX_URL = 'horizon:infrastructure:overview:index'
def _get_role_data(plan, stack, form, role): def _get_role_data(plan, stack, form, role):
"""Gathers data about a single deployment role from the related Overcloud """Gathers data about a single deployment role.
Gathers data about a single deployment role from the related Overcloud
and Role objects, and presents it in the form convenient for use and Role objects, and presents it in the form convenient for use
from the template. from the template.

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from tuskar_ui.infrastructure import dashboard from tuskar_ui.infrastructure import dashboard

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables

View File

@ -19,6 +19,7 @@ from mock import patch, call # noqa
from openstack_dashboard.test.test_data import utils from openstack_dashboard.test.test_data import utils
from tuskar_ui import api from tuskar_ui import api
from tuskar_ui.infrastructure.parameters import views
from tuskar_ui.test import helpers as test from tuskar_ui.test import helpers as test
from tuskar_ui.test.test_data import tuskar_data from tuskar_ui.test.test_data import tuskar_data
@ -31,8 +32,6 @@ SERVICE_CONFIG_URL = urlresolvers.reverse(
TEST_DATA = utils.TestDataContainer() TEST_DATA = utils.TestDataContainer()
tuskar_data.data(TEST_DATA) tuskar_data.data(TEST_DATA)
from tuskar_ui.infrastructure.parameters import views
class ParametersTest(test.BaseAdminViewTests): class ParametersTest(test.BaseAdminViewTests):

View File

@ -41,7 +41,7 @@ class ServiceConfigView(horizon.forms.ModalFormView):
virt_type = plan.parameter_value( virt_type = plan.parameter_value(
compute_prefix + 'NovaComputeLibvirtType') compute_prefix + 'NovaComputeLibvirtType')
#TODO(tzumainn): what if compute and control values are different... # TODO(tzumainn): what if compute and control values are different...
snmp_password = plan.parameter_value( snmp_password = plan.parameter_value(
compute_prefix + 'SnmpdReadonlyUserPassword') compute_prefix + 'SnmpdReadonlyUserPassword')

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from tuskar_ui.infrastructure import dashboard from tuskar_ui.infrastructure import dashboard

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from tuskar_ui import api from tuskar_ui import api

View File

@ -13,11 +13,10 @@
# under the License. # under the License.
import contextlib import contextlib
from django.core import urlresolvers from django.core import urlresolvers
from mock import patch, call # noqa
from openstack_dashboard.test.test_data import utils from openstack_dashboard.test.test_data import utils
from mock import patch, call # noqa
from tuskar_ui import api from tuskar_ui import api
from tuskar_ui.test import helpers as test from tuskar_ui.test import helpers as test

View File

@ -18,13 +18,11 @@ from django.core.urlresolvers import reverse_lazy
from django import http from django import http
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import base from django.views.generic import base
from glanceclient import exc as glance_exc from glanceclient import exc as glance_exc
from horizon import exceptions as horizon_exceptions from horizon import exceptions as horizon_exceptions
from horizon import tables as horizon_tables from horizon import tables as horizon_tables
from horizon import utils from horizon import utils
from horizon import workflows from horizon import workflows
from openstack_dashboard.api import base as api_base from openstack_dashboard.api import base as api_base
from tuskar_ui import api from tuskar_ui import api

View File

@ -13,12 +13,11 @@
# under the License. # under the License.
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions
from horizon import forms from horizon import forms
from horizon import workflows from horizon import workflows
from openstack_dashboard.api import glance from openstack_dashboard.api import glance
from tuskar_ui import api from tuskar_ui import api
from tuskar_ui import forms as tuskar_forms from tuskar_ui import forms as tuskar_forms
from tuskar_ui.infrastructure.flavors import utils from tuskar_ui.infrastructure.flavors import utils

View File

@ -45,9 +45,9 @@ def all_used_instances(obj):
info['popup_used'] = ( info['popup_used'] = (
'<p> {0}% total,' '<p> {0}% total,'
' <strong> {1} instances</strong> of {2}</p>'.format( ' <strong> {1} instances</strong> of {2}</p>'.format(
flavor.used_instances, flavor.used_instances,
flavor.used_instances, flavor.used_instances,
flavor.name)) flavor.name))
info['used_instances'] = str(flavor.used_instances) info['used_instances'] = str(flavor.used_instances)
all_used_instances_info.append(info) all_used_instances_info.append(info)

View File

@ -14,10 +14,9 @@
from __future__ import absolute_import from __future__ import absolute_import
from django.utils import unittest from django.utils import unittest
from heatclient.v1 import events
import mock import mock
from mock import patch # noqa from mock import patch # noqa
from heatclient.v1 import events
from novaclient.v1_1 import servers from novaclient.v1_1 import servers
from tuskar_ui import api from tuskar_ui import api

View File

@ -12,8 +12,8 @@
# under the License. # under the License.
import django.forms import django.forms
from horizon import tables from horizon import tables
import tuskar_ui.tables import tuskar_ui.tables
from tuskar_ui.test import helpers as test from tuskar_ui.test import helpers as test

View File

@ -16,8 +16,8 @@ import warnings
from django.core.handlers import wsgi from django.core.handlers import wsgi
from django.utils import unittest from django.utils import unittest
from openstack_dashboard.test import helpers as openstack_dashboard_helpers from openstack_dashboard.test import helpers as openstack_dashboard_helpers
from tuskar_ui.test.test_data import utils as test_data_utils from tuskar_ui.test.test_data import utils as test_data_utils
@ -37,8 +37,9 @@ def create_stubs(stubs_to_create={}):
@unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False), @unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False),
"The SKIP_UNITTESTS env variable is set.") "The SKIP_UNITTESTS env variable is set.")
class TestCase(openstack_dashboard_helpers.TestCase): class TestCase(openstack_dashboard_helpers.TestCase):
"""Specialized base test case class for Horizon which gives access to """Specialized base test case class for Horizon.
numerous additional features:
TestCase gives access to numerous additional features:
* A full suite of test data through various attached objects and * A full suite of test data through various attached objects and
managers (e.g. ``self.servers``, ``self.user``, etc.). See the managers (e.g. ``self.servers``, ``self.user``, etc.). See the
@ -69,8 +70,9 @@ class TestCase(openstack_dashboard_helpers.TestCase):
class BaseAdminViewTests(openstack_dashboard_helpers.BaseAdminViewTests): class BaseAdminViewTests(openstack_dashboard_helpers.BaseAdminViewTests):
"""A ``TestCase`` subclass which sets an active user with the "admin" role """A ``TestCase`` subclass which sets an active user with the "admin" role.
for testing admin-only views and functionality.
This is for testing admin-only views and functionality.
""" """
def setUp(self): def setUp(self):
super(BaseAdminViewTests, self).setUp() super(BaseAdminViewTests, self).setUp()
@ -80,7 +82,9 @@ class BaseAdminViewTests(openstack_dashboard_helpers.BaseAdminViewTests):
class APITestCase(openstack_dashboard_helpers.APITestCase): class APITestCase(openstack_dashboard_helpers.APITestCase):
"""The ``APITestCase`` class is for use with tests which deal with the """TestCase for testing API clients.
The ``APITestCase`` class is for use with tests which deal with the
underlying clients rather than stubbing out the underlying clients rather than stubbing out the
openstack_dashboard.api.* methods. openstack_dashboard.api.* methods.
""" """

View File

@ -12,6 +12,7 @@
# under the License. # under the License.
from openstack_dashboard.test.test_data import exceptions from openstack_dashboard.test.test_data import exceptions
from tuskarclient.openstack.common.apiclient import exceptions as tuskarclient from tuskarclient.openstack.common.apiclient import exceptions as tuskarclient

View File

@ -10,9 +10,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from openstack_dashboard.test.test_data import utils as test_data_utils
from novaclient.v1_1 import flavors from novaclient.v1_1 import flavors
from openstack_dashboard.test.test_data import utils as test_data_utils
def data(TEST): def data(TEST):

View File

@ -10,13 +10,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from openstack_dashboard.test.test_data import utils as test_data_utils
from glanceclient.v1 import images from glanceclient.v1 import images
from heatclient.v1 import events from heatclient.v1 import events
from heatclient.v1 import resources from heatclient.v1 import resources
from heatclient.v1 import stacks from heatclient.v1 import stacks
from novaclient.v1_1 import servers from novaclient.v1_1 import servers
from openstack_dashboard.test.test_data import utils as test_data_utils
def data(TEST): def data(TEST):

View File

@ -10,11 +10,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from openstack_dashboard.test.test_data import utils as test_data_utils
from ironicclient.v1 import node from ironicclient.v1 import node
from ironicclient.v1 import port from ironicclient.v1 import port
from novaclient.v1_1.contrib import baremetal from novaclient.v1_1.contrib import baremetal
from openstack_dashboard.test.test_data import utils as test_data_utils
def data(TEST): def data(TEST):

View File

@ -11,6 +11,7 @@
# under the License. # under the License.
from openstack_dashboard.test.test_data import utils as test_data_utils from openstack_dashboard.test.test_data import utils as test_data_utils
from tuskarclient.v2 import plans from tuskarclient.v2 import plans
from tuskarclient.v2 import roles from tuskarclient.v2 import roles

View File

@ -22,6 +22,7 @@ def load_test_data(load_onto=None):
from openstack_dashboard.test.test_data import neutron_data from openstack_dashboard.test.test_data import neutron_data
from openstack_dashboard.test.test_data import nova_data from openstack_dashboard.test.test_data import nova_data
from openstack_dashboard.test.test_data import swift_data from openstack_dashboard.test.test_data import swift_data
from tuskar_ui.test.test_data import exceptions from tuskar_ui.test.test_data import exceptions
from tuskar_ui.test.test_data import flavor_data from tuskar_ui.test.test_data import flavor_data
from tuskar_ui.test.test_data import heat_data as tuskar_heat_data from tuskar_ui.test.test_data import heat_data as tuskar_heat_data

View File

@ -13,7 +13,6 @@
from django.conf import urls from django.conf import urls
from django.views import generic from django.views import generic
import openstack_dashboard.urls import openstack_dashboard.urls
urlpatterns = urls.patterns( urlpatterns = urls.patterns(

View File

@ -12,16 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy import copy
from datetime import datetime # noqa from datetime import datetime # noqa
from datetime import timedelta # noqa from datetime import timedelta # noqa
from django.utils.http import urlencode from django.utils.http import urlencode
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions
from openstack_dashboard.api import ceilometer from openstack_dashboard.api import ceilometer
SETTINGS = { SETTINGS = {
@ -68,7 +65,7 @@ LABELS = {
} }
#TODO(lsmola) this should probably live in Horizon common # TODO(lsmola) this should probably live in Horizon common
def query_data(request, def query_data(request,
date_from, date_from,
date_to, date_to,
@ -117,7 +114,7 @@ def query_data(request,
return resources, unit return resources, unit
#TODO(lsmola) push this function to Horizon common then delete this # TODO(lsmola) push this function to Horizon common then delete this
def _calc_period(date_from, date_to, number_of_samples=400): def _calc_period(date_from, date_to, number_of_samples=400):
if date_from and date_to: if date_from and date_to:
if date_to < date_from: if date_to < date_from:
@ -136,7 +133,7 @@ def _calc_period(date_from, date_to, number_of_samples=400):
return period return period
#TODO(lsmola) push this function to Horizon common then delete this # TODO(lsmola) push this function to Horizon common then delete this
def _calc_date_args(date_from, date_to, date_options): def _calc_date_args(date_from, date_to, date_options):
# TODO(lsmola) all timestamps should probably work with # TODO(lsmola) all timestamps should probably work with
# current timezone. And also show the current timezone in chart. # current timezone. And also show the current timezone in chart.
@ -198,8 +195,7 @@ def get_barchart_stats(series, unit):
'%(first_date)s, to: %(last_date)s') % ( '%(first_date)s, to: %(last_date)s') % (
dict(average=average, unit=unit, dict(average=average, unit=unit,
first_date=first_date, first_date=first_date,
last_date=last_date) last_date=last_date))
)
return average, used, tooltip_average return average, used, tooltip_average

View File

@ -15,7 +15,6 @@ import logging
from django import template from django import template
from django.utils import datastructures from django.utils import datastructures
import horizon.workflows import horizon.workflows
@ -29,7 +28,9 @@ class WorkflowView(horizon.workflows.WorkflowView):
# FIXME: TableStep # FIXME: TableStep
class TableStep(horizon.workflows.Step): class TableStep(horizon.workflows.Step):
"""A :class:`~horizon.workflows.Step` class which knows how to deal with """A Step class with DataTables.
A :class:`~horizon.workflows.Step` class which knows how to deal with
:class:`~horizon.tables.DataTable` classes rendered inside of it. :class:`~horizon.tables.DataTable` classes rendered inside of it.
This distinct class is required due to the complexity involved in handling This distinct class is required due to the complexity involved in handling
@ -63,6 +64,7 @@ class TableStep(horizon.workflows.Step):
def prepare_action_context(self, request, context): def prepare_action_context(self, request, context):
"""Passes the tables to the action for validation and data extraction. """Passes the tables to the action for validation and data extraction.
""" """
self.load_table_data() self.load_table_data()
context['_tables'] = self._tables context['_tables'] = self._tables
@ -82,7 +84,9 @@ class TableStep(horizon.workflows.Step):
return step_template.render(context) return step_template.render(context)
def load_table_data(self): def load_table_data(self):
"""Calls the ``get_{{ table_name }}_data`` methods for each table class """Sets table data.
Calls the ``get_{{ table_name }}_data`` methods for each table class
and sets the data on the tables. and sets the data on the tables.
""" """
# We only want the data to be loaded once, so we track if we have... # We only want the data to be loaded once, so we track if we have...
@ -102,7 +106,9 @@ class TableStep(horizon.workflows.Step):
self._table_data_loaded = True self._table_data_loaded = True
def get_context_data(self, request): def get_context_data(self, request):
"""Adds a ``{{ table_name }}_table`` item to the context for each table """Gets the table contexct data.
Adds a ``{{ table_name }}_table`` item to the context for each table
in the :attr:`~horizon.tabs.TableTab.table_classes` attribute. in the :attr:`~horizon.tabs.TableTab.table_classes` attribute.
If only one table class is provided, a shortcut ``table`` context If only one table class is provided, a shortcut ``table`` context