Merge pull request #14 from jistr/ftr/big_red_button
Add a trigger for provisioning the data center
This commit is contained in:
commit
9efb9f1993
@ -33,3 +33,7 @@ class ClientTest(tutils.TestCase):
|
||||
self.assertEqual("FlavorManager",
|
||||
self.client.flavors.__class__.__name__)
|
||||
self.assertEqual(self.client, self.client.flavors.api)
|
||||
|
||||
self.assertEqual("DataCenterManager",
|
||||
self.client.data_centers.__class__.__name__)
|
||||
self.assertEqual(self.client, self.client.data_centers.api)
|
||||
|
32
tuskarclient/tests/v1/test_data_centers.py
Normal file
32
tuskarclient/tests/v1/test_data_centers.py
Normal file
@ -0,0 +1,32 @@
|
||||
# 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 mock
|
||||
|
||||
from tuskarclient.v1 import data_centers
|
||||
import tuskarclient.tests.utils as tutils
|
||||
|
||||
|
||||
class DataCenterManagerTest(tutils.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(DataCenterManagerTest, self).setUp()
|
||||
self.api = mock.Mock()
|
||||
self.dcm = data_centers.DataCenterManager(self.api)
|
||||
|
||||
def test_provision_all(self):
|
||||
self.api.json_request = mock.Mock(return_value={'some': 'data'})
|
||||
|
||||
self.assertEqual({'some': 'data'}, self.dcm.provision_all())
|
||||
# FIXME: Tuskar currently requires trailing slash on this URL
|
||||
self.api.json_request.assert_called_with(
|
||||
'POST', '/v1/data_centers/')
|
@ -11,6 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from tuskarclient.common import http
|
||||
from tuskarclient.v1 import data_centers
|
||||
from tuskarclient.v1 import flavors
|
||||
from tuskarclient.v1 import racks
|
||||
from tuskarclient.v1 import resource_classes
|
||||
@ -29,3 +30,4 @@ class Client(http.HTTPClient):
|
||||
self.racks = racks.RackManager(self)
|
||||
self.resource_classes = resource_classes.ResourceClassManager(self)
|
||||
self.flavors = flavors.FlavorManager(self)
|
||||
self.data_centers = data_centers.DataCenterManager(self)
|
||||
|
24
tuskarclient/v1/data_centers.py
Normal file
24
tuskarclient/v1/data_centers.py
Normal file
@ -0,0 +1,24 @@
|
||||
# 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 tuskarclient.common import base
|
||||
|
||||
|
||||
class DataCenterManager(base.Manager):
|
||||
|
||||
@staticmethod
|
||||
def _path(id=None):
|
||||
return '/v1/data_centers/%s' % id if id else '/v1/data_centers'
|
||||
|
||||
def provision_all(self):
|
||||
# FIXME: Tuskar currently requires trailing slash on this URL
|
||||
return self.api.json_request('POST', self._path() + '/')
|
Loading…
x
Reference in New Issue
Block a user