Moving Trove to contrib
Moving Trove related code to openstack_dashboard/contrib Change-Id: If3a7da604ca34d0d5a80d56989f1d11955d357df Partial: blueprint plugin-sanity
This commit is contained in:
parent
5f0bf07b95
commit
1fb6a8ac5e
@ -43,7 +43,6 @@ from openstack_dashboard.api import network
|
||||
from openstack_dashboard.api import neutron
|
||||
from openstack_dashboard.api import nova
|
||||
from openstack_dashboard.api import swift
|
||||
from openstack_dashboard.api import trove
|
||||
from openstack_dashboard.api import vpn
|
||||
|
||||
|
||||
@ -60,6 +59,5 @@ __all__ = [
|
||||
"nova",
|
||||
"swift",
|
||||
"ceilometer",
|
||||
"trove",
|
||||
"vpn",
|
||||
]
|
||||
|
5
openstack_dashboard/contrib/trove/api/__init__.py
Normal file
5
openstack_dashboard/contrib/trove/api/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
from openstack_dashboard.contrib.trove.api import trove
|
||||
|
||||
__all__ = [
|
||||
"trove"
|
||||
]
|
@ -21,7 +21,7 @@ from django.utils.translation import ungettext_lazy
|
||||
from horizon import tables
|
||||
from horizon.utils import filters
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
|
||||
|
||||
STATUS_CHOICES = (
|
@ -16,7 +16,7 @@ from django.core.urlresolvers import reverse
|
||||
from django import http
|
||||
from mox3.mox import IsA # noqa
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
INDEX_URL = reverse('horizon:project:database_backups:index')
|
@ -15,7 +15,7 @@
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from openstack_dashboard.dashboards.project.database_backups import views
|
||||
from openstack_dashboard.contrib.trove.content.database_backups import views
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
@ -24,9 +24,10 @@ from horizon.utils import filters
|
||||
from horizon import views as horizon_views
|
||||
from horizon import workflows as horizon_workflows
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.database_backups import tables
|
||||
from openstack_dashboard.dashboards.project.database_backups import workflows
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
from openstack_dashboard.contrib.trove.content.database_backups import tables
|
||||
from openstack_dashboard.contrib.trove.content.database_backups \
|
||||
import workflows
|
||||
|
||||
|
||||
class IndexView(horizon_tables.DataTableView):
|
@ -20,8 +20,8 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import workflows
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.databases \
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
from openstack_dashboard.contrib.trove.content.databases \
|
||||
import tables as project_tables
|
||||
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import messages
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
|
||||
|
||||
class ResizeVolumeForm(forms.SelfHandlingForm):
|
@ -23,8 +23,8 @@ from horizon import tables
|
||||
from horizon.templatetags import sizeformat
|
||||
from horizon.utils import filters
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.database_backups \
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
from openstack_dashboard.contrib.trove.content.database_backups \
|
||||
import tables as backup_tables
|
||||
|
||||
|
@ -18,8 +18,8 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.databases import tables
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
from openstack_dashboard.contrib.trove.content.databases import tables
|
||||
|
||||
|
||||
class OverviewTab(tabs.Tab):
|
@ -23,7 +23,8 @@ from django.utils import unittest
|
||||
from mox3.mox import IsA # noqa
|
||||
|
||||
from horizon import exceptions
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard import api as dash_api
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
from troveclient import common
|
||||
@ -125,7 +126,7 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove: ('flavor_list', 'backup_list',
|
||||
'datastore_list', 'datastore_version_list',
|
||||
'instance_list'),
|
||||
api.neutron: ('network_list',)})
|
||||
dash_api.neutron: ('network_list',)})
|
||||
def test_launch_instance(self):
|
||||
api.trove.flavor_list(IsA(http.HttpRequest)).AndReturn(
|
||||
self.flavors.list())
|
||||
@ -140,14 +141,14 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest), IsA(str)).\
|
||||
AndReturn(self.datastore_versions.list())
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndReturn(
|
||||
self.networks.list()[:1])
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndReturn(
|
||||
self.networks.list()[:1])
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).AndReturn(
|
||||
self.networks.list()[1:])
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).AndReturn(
|
||||
self.networks.list()[1:])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(LAUNCH_URL)
|
||||
@ -188,7 +189,7 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove: ('flavor_list', 'backup_list', 'instance_create',
|
||||
'datastore_list', 'datastore_version_list',
|
||||
'instance_list'),
|
||||
api.neutron: ('network_list',)})
|
||||
dash_api.neutron: ('network_list',)})
|
||||
def test_create_simple_instance(self):
|
||||
api.trove.flavor_list(IsA(http.HttpRequest)).AndReturn(
|
||||
self.flavors.list())
|
||||
@ -207,14 +208,14 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest), IsA(str))\
|
||||
.AndReturn(self.datastore_versions.list())
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndReturn(
|
||||
self.networks.list()[:1])
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndReturn(
|
||||
self.networks.list()[:1])
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).AndReturn(
|
||||
self.networks.list()[1:])
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).AndReturn(
|
||||
self.networks.list()[1:])
|
||||
|
||||
nics = [{"net-id": self.networks.first().id, "v4-fixed-ip": ''}]
|
||||
|
||||
@ -248,7 +249,7 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove: ('flavor_list', 'backup_list', 'instance_create',
|
||||
'datastore_list', 'datastore_version_list',
|
||||
'instance_list'),
|
||||
api.neutron: ('network_list',)})
|
||||
dash_api.neutron: ('network_list',)})
|
||||
def test_create_simple_instance_exception(self):
|
||||
trove_exception = self.exceptions.nova
|
||||
api.trove.flavor_list(IsA(http.HttpRequest)).AndReturn(
|
||||
@ -268,14 +269,14 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove.datastore_version_list(IsA(http.HttpRequest), IsA(str))\
|
||||
.AndReturn(self.datastore_versions.list())
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndReturn(
|
||||
self.networks.list()[:1])
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndReturn(
|
||||
self.networks.list()[:1])
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).AndReturn(
|
||||
self.networks.list()[1:])
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).AndReturn(
|
||||
self.networks.list()[1:])
|
||||
|
||||
nics = [{"net-id": self.networks.first().id, "v4-fixed-ip": ''}]
|
||||
|
||||
@ -481,7 +482,7 @@ class DatabaseTests(test.TestCase):
|
||||
api.trove: ('flavor_list', 'backup_list', 'instance_create',
|
||||
'datastore_list', 'datastore_version_list',
|
||||
'instance_list', 'instance_get'),
|
||||
api.neutron: ('network_list',)})
|
||||
dash_api.neutron: ('network_list',)})
|
||||
def test_create_replica_instance(self):
|
||||
api.trove.flavor_list(IsA(http.HttpRequest)).AndReturn(
|
||||
self.flavors.list())
|
||||
@ -499,13 +500,13 @@ class DatabaseTests(test.TestCase):
|
||||
IsA(str))\
|
||||
.AndReturn(self.datastore_versions.list())
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).\
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).\
|
||||
AndReturn(self.networks.list()[:1])
|
||||
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).\
|
||||
dash_api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True).\
|
||||
AndReturn(self.networks.list()[1:])
|
||||
|
||||
nics = [{"net-id": self.networks.first().id, "v4-fixed-ip": ''}]
|
@ -15,7 +15,7 @@
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from openstack_dashboard.dashboards.project.databases import views
|
||||
from openstack_dashboard.contrib.trove.content.databases import views
|
||||
|
||||
|
||||
INSTANCES = r'^(?P<instance_id>[^/]+)/%s$'
|
@ -29,11 +29,11 @@ from horizon import tabs as horizon_tabs
|
||||
from horizon.utils import memoized
|
||||
from horizon import workflows as horizon_workflows
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.databases import forms
|
||||
from openstack_dashboard.dashboards.project.databases import tables
|
||||
from openstack_dashboard.dashboards.project.databases import tabs
|
||||
from openstack_dashboard.dashboards.project.databases import workflows
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
from openstack_dashboard.contrib.trove.content.databases import forms
|
||||
from openstack_dashboard.contrib.trove.content.databases import tables
|
||||
from openstack_dashboard.contrib.trove.content.databases import tabs
|
||||
from openstack_dashboard.contrib.trove.content.databases import workflows
|
||||
|
||||
from openstack_dashboard.dashboards.project.instances \
|
||||
import utils as instance_utils
|
@ -22,7 +22,8 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon.utils import memoized
|
||||
from horizon import workflows
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard import api as dash_api
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
|
||||
from openstack_dashboard.dashboards.project.instances \
|
||||
import utils as instance_utils
|
||||
@ -151,7 +152,8 @@ class SetNetworkAction(workflows.Action):
|
||||
def populate_network_choices(self, request, context):
|
||||
try:
|
||||
tenant_id = self.request.user.tenant_id
|
||||
networks = api.neutron.network_list_for_tenant(request, tenant_id)
|
||||
networks = dash_api.neutron.network_list_for_tenant(request,
|
||||
tenant_id)
|
||||
network_list = [(network.id, network.name_or_id)
|
||||
for network in networks]
|
||||
except Exception:
|
0
openstack_dashboard/contrib/trove/test/__init__.py
Normal file
0
openstack_dashboard/contrib/trove/test/__init__.py
Normal file
38
openstack_dashboard/contrib/trove/test/helpers.py
Normal file
38
openstack_dashboard/contrib/trove/test/helpers.py
Normal file
@ -0,0 +1,38 @@
|
||||
#
|
||||
# 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.
|
||||
|
||||
from troveclient import client as trove_client
|
||||
|
||||
from openstack_dashboard.test import helpers
|
||||
|
||||
from openstack_dashboard.contrib.trove import api
|
||||
|
||||
|
||||
class TroveAPITestCase(helpers.APITestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TroveAPITestCase, self).setUp()
|
||||
|
||||
self._original_troveclient = api.trove.client
|
||||
api.trove.client = lambda request: self.stub_troveclient()
|
||||
|
||||
def tearDown(self):
|
||||
super(TroveAPITestCase, self).tearDown()
|
||||
|
||||
api.trove.client = self._original_troveclient
|
||||
|
||||
def stub_troveclient(self):
|
||||
if not hasattr(self, "troveclient"):
|
||||
self.mox.StubOutWithMock(trove_client, 'Client')
|
||||
self.troveclient = self.mox.CreateMock(trove_client.Client)
|
||||
return self.troveclient
|
@ -21,5 +21,4 @@ class Project(horizon.Dashboard):
|
||||
name = _("Project")
|
||||
slug = "project"
|
||||
|
||||
|
||||
horizon.register(Project)
|
||||
|
@ -6,4 +6,5 @@ PANEL_DASHBOARD = 'project'
|
||||
PANEL_GROUP = 'database'
|
||||
|
||||
# Python panel class of the PANEL to be added.
|
||||
ADD_PANEL = 'openstack_dashboard.dashboards.project.databases.panel.Databases'
|
||||
ADD_PANEL = ('openstack_dashboard.contrib.trove.'
|
||||
'content.databases.panel.Databases')
|
||||
|
@ -6,5 +6,5 @@ PANEL_DASHBOARD = 'project'
|
||||
PANEL_GROUP = 'database'
|
||||
|
||||
# Python panel class of the PANEL to be added.
|
||||
ADD_PANEL = ('openstack_dashboard.dashboards.project.'
|
||||
'database_backups.panel.Backups')
|
||||
ADD_PANEL = ('openstack_dashboard.contrib.trove.'
|
||||
'content.database_backups.panel.Backups')
|
||||
|
@ -44,7 +44,6 @@ from novaclient.v2 import client as nova_client
|
||||
from openstack_auth import user
|
||||
from openstack_auth import utils
|
||||
from swiftclient import client as swift_client
|
||||
from troveclient import client as trove_client
|
||||
|
||||
from horizon import base
|
||||
from horizon import conf
|
||||
@ -343,7 +342,6 @@ class APITestCase(TestCase):
|
||||
self._original_cinderclient = api.cinder.cinderclient
|
||||
self._original_heatclient = api.heat.heatclient
|
||||
self._original_ceilometerclient = api.ceilometer.ceilometerclient
|
||||
self._original_troveclient = api.trove.troveclient
|
||||
|
||||
# Replace the clients with our stubs.
|
||||
api.glance.glanceclient = lambda request: self.stub_glanceclient()
|
||||
@ -355,7 +353,6 @@ class APITestCase(TestCase):
|
||||
self.stub_heatclient())
|
||||
api.ceilometer.ceilometerclient = (lambda request:
|
||||
self.stub_ceilometerclient())
|
||||
api.trove.troveclient = lambda request: self.stub_troveclient()
|
||||
|
||||
def tearDown(self):
|
||||
super(APITestCase, self).tearDown()
|
||||
@ -366,7 +363,6 @@ class APITestCase(TestCase):
|
||||
api.cinder.cinderclient = self._original_cinderclient
|
||||
api.heat.heatclient = self._original_heatclient
|
||||
api.ceilometer.ceilometerclient = self._original_ceilometerclient
|
||||
api.trove.troveclient = self._original_troveclient
|
||||
|
||||
def stub_novaclient(self):
|
||||
if not hasattr(self, "novaclient"):
|
||||
@ -435,12 +431,6 @@ class APITestCase(TestCase):
|
||||
CreateMock(ceilometer_client.Client)
|
||||
return self.ceilometerclient
|
||||
|
||||
def stub_troveclient(self):
|
||||
if not hasattr(self, "troveclient"):
|
||||
self.mox.StubOutWithMock(trove_client, 'Client')
|
||||
self.troveclient = self.mox.CreateMock(trove_client.Client)
|
||||
return self.troveclient
|
||||
|
||||
|
||||
@unittest.skipUnless(os.environ.get('WITH_SELENIUM', False),
|
||||
"The WITH_SELENIUM env variable is not set.")
|
||||
|
Loading…
Reference in New Issue
Block a user