Fix H302 errors
Change-Id: I0354b4c99fb6d22ede85ec711fb81c2bb3627f99
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
# 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 heatclient.common.template_format import yaml_loader
|
from heatclient.common import template_format
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ def parse(env_str):
|
|||||||
YAML format.
|
YAML format.
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
env = yaml.load(env_str, Loader=yaml_loader)
|
env = yaml.load(env_str, Loader=template_format.yaml_loader)
|
||||||
except yaml.YAMLError as yea:
|
except yaml.YAMLError as yea:
|
||||||
raise ValueError(yea)
|
raise ValueError(yea)
|
||||||
else:
|
else:
|
||||||
|
@@ -33,7 +33,7 @@ import heatclient
|
|||||||
from heatclient import client as heat_client
|
from heatclient import client as heat_client
|
||||||
from heatclient.common import utils
|
from heatclient.common import utils
|
||||||
from heatclient import exc
|
from heatclient import exc
|
||||||
from heatclient.openstack.common.gettextutils import _
|
from heatclient.openstack.common.gettextutils import _ # noqa
|
||||||
from heatclient.openstack.common import importutils
|
from heatclient.openstack.common import importutils
|
||||||
from heatclient.openstack.common import strutils
|
from heatclient.openstack.common import strutils
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
import mock
|
import mock
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from heatclient.v1.build_info import BuildInfoManager
|
from heatclient.v1 import build_info
|
||||||
|
|
||||||
|
|
||||||
class BuildInfoManagerTest(testtools.TestCase):
|
class BuildInfoManagerTest(testtools.TestCase):
|
||||||
@@ -24,7 +24,7 @@ class BuildInfoManagerTest(testtools.TestCase):
|
|||||||
super(BuildInfoManagerTest, self).setUp()
|
super(BuildInfoManagerTest, self).setUp()
|
||||||
self.client = mock.Mock()
|
self.client = mock.Mock()
|
||||||
self.client.json_request.return_value = ('resp', 'body')
|
self.client.json_request.return_value = ('resp', 'body')
|
||||||
self.manager = BuildInfoManager(self.client)
|
self.manager = build_info.BuildInfoManager(self.client)
|
||||||
|
|
||||||
def test_build_info_makes_a_call_to_the_api(self):
|
def test_build_info_makes_a_call_to_the_api(self):
|
||||||
self.manager.build_info()
|
self.manager.build_info()
|
||||||
|
@@ -13,10 +13,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from heatclient.common import utils
|
from heatclient.common import utils
|
||||||
from heatclient.v1.events import EventManager
|
from heatclient.v1 import events
|
||||||
|
|
||||||
from mock import MagicMock
|
import mock
|
||||||
from mock import patch
|
|
||||||
from mox3 import mox
|
from mox3 import mox
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
@@ -32,11 +31,11 @@ class EventManagerTest(testtools.TestCase):
|
|||||||
def test_list_event(self):
|
def test_list_event(self):
|
||||||
stack_id = 'teststack',
|
stack_id = 'teststack',
|
||||||
resource_name = 'testresource'
|
resource_name = 'testresource'
|
||||||
manager = EventManager(None)
|
manager = events.EventManager(None)
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id(stack_id).AndReturn('teststack/abcd1234')
|
manager._resolve_stack_id(stack_id).AndReturn('teststack/abcd1234')
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
manager._list = MagicMock()
|
manager._list = mock.MagicMock()
|
||||||
manager.list(stack_id, resource_name)
|
manager.list(stack_id, resource_name)
|
||||||
# Make sure url is correct.
|
# Make sure url is correct.
|
||||||
manager._list.assert_called_once_with('/stacks/teststack%2Fabcd1234/'
|
manager._list.assert_called_once_with('/stacks/teststack%2Fabcd1234/'
|
||||||
@@ -46,11 +45,11 @@ class EventManagerTest(testtools.TestCase):
|
|||||||
def test_list_event_with_unicode_resource_name(self):
|
def test_list_event_with_unicode_resource_name(self):
|
||||||
stack_id = 'teststack',
|
stack_id = 'teststack',
|
||||||
resource_name = u'\u5de5\u4f5c'
|
resource_name = u'\u5de5\u4f5c'
|
||||||
manager = EventManager(None)
|
manager = events.EventManager(None)
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id(stack_id).AndReturn('teststack/abcd1234')
|
manager._resolve_stack_id(stack_id).AndReturn('teststack/abcd1234')
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
manager._list = MagicMock()
|
manager._list = mock.MagicMock()
|
||||||
manager.list(stack_id, resource_name)
|
manager.list(stack_id, resource_name)
|
||||||
# Make sure url is correct.
|
# Make sure url is correct.
|
||||||
manager._list.assert_called_once_with('/stacks/teststack%2Fabcd1234/'
|
manager._list.assert_called_once_with('/stacks/teststack%2Fabcd1234/'
|
||||||
@@ -59,8 +58,8 @@ class EventManagerTest(testtools.TestCase):
|
|||||||
|
|
||||||
def test_list_event_with_none_resource_name(self):
|
def test_list_event_with_none_resource_name(self):
|
||||||
stack_id = 'teststack',
|
stack_id = 'teststack',
|
||||||
manager = EventManager(None)
|
manager = events.EventManager(None)
|
||||||
manager._list = MagicMock()
|
manager._list = mock.MagicMock()
|
||||||
manager.list(stack_id)
|
manager.list(stack_id)
|
||||||
# Make sure url is correct.
|
# Make sure url is correct.
|
||||||
manager._list.assert_called_once_with('/stacks/teststack/'
|
manager._list.assert_called_once_with('/stacks/teststack/'
|
||||||
@@ -75,11 +74,11 @@ class EventManagerTest(testtools.TestCase):
|
|||||||
'resource_action': 'CREATE',
|
'resource_action': 'CREATE',
|
||||||
'resource_status': 'COMPLETE'
|
'resource_status': 'COMPLETE'
|
||||||
}}
|
}}
|
||||||
manager = EventManager(None)
|
manager = events.EventManager(None)
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id(stack_id).AndReturn('teststack/abcd1234')
|
manager._resolve_stack_id(stack_id).AndReturn('teststack/abcd1234')
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
manager._list = MagicMock()
|
manager._list = mock.MagicMock()
|
||||||
manager.list(stack_id, resource_name, **kwargs)
|
manager.list(stack_id, resource_name, **kwargs)
|
||||||
# Make sure url is correct.
|
# Make sure url is correct.
|
||||||
self.assertEqual(1, manager._list.call_count)
|
self.assertEqual(1, manager._list.call_count)
|
||||||
@@ -112,8 +111,8 @@ class EventManagerTest(testtools.TestCase):
|
|||||||
assert args == expect
|
assert args == expect
|
||||||
return {}, {'event': []}
|
return {}, {'event': []}
|
||||||
|
|
||||||
manager = EventManager(FakeAPI())
|
manager = events.EventManager(FakeAPI())
|
||||||
with patch('heatclient.v1.events.Event'):
|
with mock.patch('heatclient.v1.events.Event'):
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id('teststack').AndReturn(
|
manager._resolve_stack_id('teststack').AndReturn(
|
||||||
'teststack/abcd1234')
|
'teststack/abcd1234')
|
||||||
@@ -135,8 +134,8 @@ class EventManagerTest(testtools.TestCase):
|
|||||||
assert args == expect
|
assert args == expect
|
||||||
return {}, {'event': []}
|
return {}, {'event': []}
|
||||||
|
|
||||||
manager = EventManager(FakeAPI())
|
manager = events.EventManager(FakeAPI())
|
||||||
with patch('heatclient.v1.events.Event'):
|
with mock.patch('heatclient.v1.events.Event'):
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id('teststack').AndReturn(
|
manager._resolve_stack_id('teststack').AndReturn(
|
||||||
'teststack/abcd1234')
|
'teststack/abcd1234')
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from heatclient.v1.resource_types import ResourceTypeManager
|
from heatclient.v1 import resource_types
|
||||||
|
|
||||||
|
|
||||||
class ResourceTypeManagerTest(testtools.TestCase):
|
class ResourceTypeManagerTest(testtools.TestCase):
|
||||||
@@ -31,7 +31,7 @@ class ResourceTypeManagerTest(testtools.TestCase):
|
|||||||
ret = key and {key: []} or {}
|
ret = key and {key: []} or {}
|
||||||
return {}, {key: ret}
|
return {}, {key: ret}
|
||||||
|
|
||||||
manager = ResourceTypeManager(FakeAPI())
|
manager = resource_types.ResourceTypeManager(FakeAPI())
|
||||||
return manager
|
return manager
|
||||||
|
|
||||||
def test_list_types(self):
|
def test_list_types(self):
|
||||||
@@ -47,7 +47,7 @@ class ResourceTypeManagerTest(testtools.TestCase):
|
|||||||
assert ('GET', args[0]) == expect
|
assert ('GET', args[0]) == expect
|
||||||
return FakeResponse()
|
return FakeResponse()
|
||||||
|
|
||||||
manager = ResourceTypeManager(FakeClient())
|
manager = resource_types.ResourceTypeManager(FakeClient())
|
||||||
manager.list()
|
manager.list()
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
# 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 heatclient.v1.resources import ResourceManager
|
from heatclient.v1 import resources
|
||||||
|
|
||||||
from mox3 import mox
|
from mox3 import mox
|
||||||
import testtools
|
import testtools
|
||||||
@@ -39,7 +39,7 @@ class ResourceManagerTest(testtools.TestCase):
|
|||||||
ret = key and {key: []} or {}
|
ret = key and {key: []} or {}
|
||||||
return {}, {key: ret}
|
return {}, {key: ret}
|
||||||
|
|
||||||
manager = ResourceManager(FakeAPI())
|
manager = resources.ResourceManager(FakeAPI())
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id('teststack').AndReturn('teststack/abcd1234')
|
manager._resolve_stack_id('teststack').AndReturn('teststack/abcd1234')
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
@@ -82,7 +82,7 @@ class ResourceManagerTest(testtools.TestCase):
|
|||||||
assert args[0] == expect
|
assert args[0] == expect
|
||||||
return FakeResponse()
|
return FakeResponse()
|
||||||
|
|
||||||
manager = ResourceManager(FakeClient())
|
manager = resources.ResourceManager(FakeClient())
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id('teststack').AndReturn('teststack/abcd1234')
|
manager._resolve_stack_id('teststack').AndReturn('teststack/abcd1234')
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
@@ -103,7 +103,7 @@ class ResourceManagerTest(testtools.TestCase):
|
|||||||
assert args[0] == expect
|
assert args[0] == expect
|
||||||
return FakeResponse()
|
return FakeResponse()
|
||||||
|
|
||||||
manager = ResourceManager(FakeClient())
|
manager = resources.ResourceManager(FakeClient())
|
||||||
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
self.m.StubOutWithMock(manager, '_resolve_stack_id')
|
||||||
manager._resolve_stack_id('teststack').AndReturn('teststack/abcd1234')
|
manager._resolve_stack_id('teststack').AndReturn('teststack/abcd1234')
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
@@ -13,8 +13,7 @@
|
|||||||
import mock
|
import mock
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from heatclient.v1.software_configs import SoftwareConfig
|
from heatclient.v1 import software_configs
|
||||||
from heatclient.v1.software_configs import SoftwareConfigManager
|
|
||||||
|
|
||||||
|
|
||||||
class SoftwareConfigTest(testtools.TestCase):
|
class SoftwareConfigTest(testtools.TestCase):
|
||||||
@@ -22,7 +21,8 @@ class SoftwareConfigTest(testtools.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SoftwareConfigTest, self).setUp()
|
super(SoftwareConfigTest, self).setUp()
|
||||||
config_id = 'bca6871d-86c0-4aff-b792-58a1f6947b57'
|
config_id = 'bca6871d-86c0-4aff-b792-58a1f6947b57'
|
||||||
self.config = SoftwareConfig(mock.MagicMock(), info={'id': config_id})
|
self.config = software_configs.SoftwareConfig(mock.MagicMock(),
|
||||||
|
info={'id': config_id})
|
||||||
self.config_id = config_id
|
self.config_id = config_id
|
||||||
|
|
||||||
def test_delete(self):
|
def test_delete(self):
|
||||||
@@ -44,7 +44,7 @@ class SoftwareConfigManagerTest(testtools.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SoftwareConfigManagerTest, self).setUp()
|
super(SoftwareConfigManagerTest, self).setUp()
|
||||||
self.manager = SoftwareConfigManager(mock.MagicMock())
|
self.manager = software_configs.SoftwareConfigManager(mock.MagicMock())
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
config_id = 'bca6871d-86c0-4aff-b792-58a1f6947b57'
|
config_id = 'bca6871d-86c0-4aff-b792-58a1f6947b57'
|
||||||
@@ -60,7 +60,8 @@ class SoftwareConfigManagerTest(testtools.TestCase):
|
|||||||
self.manager.client.json_request.return_value = (
|
self.manager.client.json_request.return_value = (
|
||||||
{}, {'software_config': data})
|
{}, {'software_config': data})
|
||||||
result = self.manager.get(config_id=config_id)
|
result = self.manager.get(config_id=config_id)
|
||||||
self.assertEqual(SoftwareConfig(self.manager, data), result)
|
self.assertEqual(software_configs.SoftwareConfig(self.manager, data),
|
||||||
|
result)
|
||||||
call_args = self.manager.client.json_request.call_args
|
call_args = self.manager.client.json_request.call_args
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
('GET', '/software_configs/%s' % config_id), *call_args)
|
('GET', '/software_configs/%s' % config_id), *call_args)
|
||||||
@@ -79,7 +80,8 @@ class SoftwareConfigManagerTest(testtools.TestCase):
|
|||||||
self.manager.client.json_request.return_value = (
|
self.manager.client.json_request.return_value = (
|
||||||
{}, {'software_config': data})
|
{}, {'software_config': data})
|
||||||
result = self.manager.create(**body)
|
result = self.manager.create(**body)
|
||||||
self.assertEqual(SoftwareConfig(self.manager, data), result)
|
self.assertEqual(software_configs.SoftwareConfig(self.manager, data),
|
||||||
|
result)
|
||||||
args, kargs = self.manager.client.json_request.call_args
|
args, kargs = self.manager.client.json_request.call_args
|
||||||
self.assertEqual('POST', args[0])
|
self.assertEqual('POST', args[0])
|
||||||
self.assertEqual('/software_configs', args[1])
|
self.assertEqual('/software_configs', args[1])
|
||||||
|
@@ -13,8 +13,7 @@
|
|||||||
import mock
|
import mock
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from heatclient.v1.software_deployments import SoftwareDeployment
|
from heatclient.v1 import software_deployments
|
||||||
from heatclient.v1.software_deployments import SoftwareDeploymentManager
|
|
||||||
|
|
||||||
|
|
||||||
class SoftwareDeploymentTest(testtools.TestCase):
|
class SoftwareDeploymentTest(testtools.TestCase):
|
||||||
@@ -22,7 +21,7 @@ class SoftwareDeploymentTest(testtools.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SoftwareDeploymentTest, self).setUp()
|
super(SoftwareDeploymentTest, self).setUp()
|
||||||
deployment_id = 'bca6871d-86c0-4aff-b792-58a1f6947b57'
|
deployment_id = 'bca6871d-86c0-4aff-b792-58a1f6947b57'
|
||||||
self.deployment = SoftwareDeployment(
|
self.deployment = software_deployments.SoftwareDeployment(
|
||||||
mock.MagicMock(), info={'id': deployment_id})
|
mock.MagicMock(), info={'id': deployment_id})
|
||||||
self.deployment_id = deployment_id
|
self.deployment_id = deployment_id
|
||||||
|
|
||||||
@@ -48,7 +47,8 @@ class SoftwareDeploymentManagerTest(testtools.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SoftwareDeploymentManagerTest, self).setUp()
|
super(SoftwareDeploymentManagerTest, self).setUp()
|
||||||
self.manager = SoftwareDeploymentManager(mock.MagicMock())
|
self.manager = software_deployments.SoftwareDeploymentManager(
|
||||||
|
mock.MagicMock())
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
server_id = 'fc01f89f-e151-4dc5-9c28-543c0d20ed6a'
|
server_id = 'fc01f89f-e151-4dc5-9c28-543c0d20ed6a'
|
||||||
@@ -102,7 +102,8 @@ class SoftwareDeploymentManagerTest(testtools.TestCase):
|
|||||||
self.manager.client.json_request.return_value = (
|
self.manager.client.json_request.return_value = (
|
||||||
{}, {'software_deployment': data})
|
{}, {'software_deployment': data})
|
||||||
result = self.manager.get(deployment_id=deployment_id)
|
result = self.manager.get(deployment_id=deployment_id)
|
||||||
self.assertEqual(SoftwareDeployment(self.manager, data), result)
|
self.assertEqual(software_deployments.SoftwareDeployment(
|
||||||
|
self.manager, data), result)
|
||||||
call_args = self.manager.client.json_request.call_args
|
call_args = self.manager.client.json_request.call_args
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
('GET', '/software_deployments/%s' % deployment_id), *call_args)
|
('GET', '/software_deployments/%s' % deployment_id), *call_args)
|
||||||
@@ -124,7 +125,8 @@ class SoftwareDeploymentManagerTest(testtools.TestCase):
|
|||||||
self.manager.client.json_request.return_value = (
|
self.manager.client.json_request.return_value = (
|
||||||
{}, {'software_deployment': data})
|
{}, {'software_deployment': data})
|
||||||
result = self.manager.create(**body)
|
result = self.manager.create(**body)
|
||||||
self.assertEqual(SoftwareDeployment(self.manager, data), result)
|
self.assertEqual(software_deployments.SoftwareDeployment(
|
||||||
|
self.manager, data), result)
|
||||||
args, kwargs = self.manager.client.json_request.call_args
|
args, kwargs = self.manager.client.json_request.call_args
|
||||||
self.assertEqual('POST', args[0])
|
self.assertEqual('POST', args[0])
|
||||||
self.assertEqual('/software_deployments', args[1])
|
self.assertEqual('/software_deployments', args[1])
|
||||||
@@ -154,7 +156,8 @@ class SoftwareDeploymentManagerTest(testtools.TestCase):
|
|||||||
self.manager.client.json_request.return_value = (
|
self.manager.client.json_request.return_value = (
|
||||||
{}, {'software_deployment': data})
|
{}, {'software_deployment': data})
|
||||||
result = self.manager.update(deployment_id, **body)
|
result = self.manager.update(deployment_id, **body)
|
||||||
self.assertEqual(SoftwareDeployment(self.manager, data), result)
|
self.assertEqual(software_deployments.SoftwareDeployment(
|
||||||
|
self.manager, data), result)
|
||||||
args, kwargs = self.manager.client.json_request.call_args
|
args, kwargs = self.manager.client.json_request.call_args
|
||||||
self.assertEqual('PUT', args[0])
|
self.assertEqual('PUT', args[0])
|
||||||
self.assertEqual('/software_deployments/%s' % deployment_id, args[1])
|
self.assertEqual('/software_deployments/%s' % deployment_id, args[1])
|
||||||
|
@@ -9,19 +9,18 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# 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 heatclient.v1.stacks import Stack
|
from heatclient.v1 import stacks
|
||||||
from heatclient.v1.stacks import StackManager
|
|
||||||
|
|
||||||
from mock import MagicMock
|
import mock
|
||||||
import testscenarios
|
import testscenarios
|
||||||
from testscenarios.scenarios import multiply_scenarios
|
from testscenarios import scenarios as scnrs
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
load_tests = testscenarios.load_tests_apply_scenarios
|
load_tests = testscenarios.load_tests_apply_scenarios
|
||||||
|
|
||||||
|
|
||||||
def mock_stack(manager, stack_name, stack_id):
|
def mock_stack(manager, stack_name, stack_id):
|
||||||
return Stack(manager, {
|
return stacks.Stack(manager, {
|
||||||
"id": stack_id,
|
"id": stack_id,
|
||||||
"stack_name": stack_name,
|
"stack_name": stack_name,
|
||||||
"links": [{
|
"links": [{
|
||||||
@@ -38,7 +37,7 @@ def mock_stack(manager, stack_name, stack_id):
|
|||||||
|
|
||||||
class StackStatusActionTest(testtools.TestCase):
|
class StackStatusActionTest(testtools.TestCase):
|
||||||
|
|
||||||
scenarios = multiply_scenarios([
|
scenarios = scnrs.multiply_scenarios([
|
||||||
('CREATE', dict(action='CREATE')),
|
('CREATE', dict(action='CREATE')),
|
||||||
('DELETE', dict(action='DELETE')),
|
('DELETE', dict(action='DELETE')),
|
||||||
('UPDATE', dict(action='UPDATE')),
|
('UPDATE', dict(action='UPDATE')),
|
||||||
@@ -70,70 +69,70 @@ class StackIdentifierTest(testtools.TestCase):
|
|||||||
class StackOperationsTest(testtools.TestCase):
|
class StackOperationsTest(testtools.TestCase):
|
||||||
|
|
||||||
def test_delete_stack(self):
|
def test_delete_stack(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.delete()
|
stack.delete()
|
||||||
manager.delete.assert_called_once_with('the_stack/abcd1234')
|
manager.delete.assert_called_once_with('the_stack/abcd1234')
|
||||||
|
|
||||||
def test_abandon_stack(self):
|
def test_abandon_stack(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.abandon()
|
stack.abandon()
|
||||||
manager.abandon.assert_called_once_with('the_stack/abcd1234')
|
manager.abandon.assert_called_once_with('the_stack/abcd1234')
|
||||||
|
|
||||||
def test_get_stack(self):
|
def test_get_stack(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.get()
|
stack.get()
|
||||||
manager.get.assert_called_once_with('the_stack/abcd1234')
|
manager.get.assert_called_once_with('the_stack/abcd1234')
|
||||||
|
|
||||||
def test_update_stack(self):
|
def test_update_stack(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.update()
|
stack.update()
|
||||||
manager.update.assert_called_once_with('the_stack/abcd1234')
|
manager.update.assert_called_once_with('the_stack/abcd1234')
|
||||||
|
|
||||||
def test_create_stack(self):
|
def test_create_stack(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack = stack.create()
|
stack = stack.create()
|
||||||
manager.create.assert_called_once_with('the_stack/abcd1234')
|
manager.create.assert_called_once_with('the_stack/abcd1234')
|
||||||
|
|
||||||
def test_preview_stack(self):
|
def test_preview_stack(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack = stack.preview()
|
stack = stack.preview()
|
||||||
manager.preview.assert_called_once_with()
|
manager.preview.assert_called_once_with()
|
||||||
|
|
||||||
def test_snapshot(self):
|
def test_snapshot(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.snapshot('foo')
|
stack.snapshot('foo')
|
||||||
manager.snapshot.assert_called_once_with('the_stack/abcd1234', 'foo')
|
manager.snapshot.assert_called_once_with('the_stack/abcd1234', 'foo')
|
||||||
|
|
||||||
def test_snapshot_show(self):
|
def test_snapshot_show(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.snapshot_show('snap1234')
|
stack.snapshot_show('snap1234')
|
||||||
manager.snapshot_show.assert_called_once_with(
|
manager.snapshot_show.assert_called_once_with(
|
||||||
'the_stack/abcd1234', 'snap1234')
|
'the_stack/abcd1234', 'snap1234')
|
||||||
|
|
||||||
def test_snapshot_delete(self):
|
def test_snapshot_delete(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.snapshot_delete('snap1234')
|
stack.snapshot_delete('snap1234')
|
||||||
manager.snapshot_delete.assert_called_once_with(
|
manager.snapshot_delete.assert_called_once_with(
|
||||||
'the_stack/abcd1234', 'snap1234')
|
'the_stack/abcd1234', 'snap1234')
|
||||||
|
|
||||||
def test_restore(self):
|
def test_restore(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.restore('snap1234')
|
stack.restore('snap1234')
|
||||||
manager.restore.assert_called_once_with(
|
manager.restore.assert_called_once_with(
|
||||||
'the_stack/abcd1234', 'snap1234')
|
'the_stack/abcd1234', 'snap1234')
|
||||||
|
|
||||||
def test_snapshot_list(self):
|
def test_snapshot_list(self):
|
||||||
manager = MagicMock()
|
manager = mock.MagicMock()
|
||||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||||
stack.snapshot_list()
|
stack.snapshot_list()
|
||||||
manager.snapshot_list.assert_called_once_with('the_stack/abcd1234')
|
manager.snapshot_list.assert_called_once_with('the_stack/abcd1234')
|
||||||
@@ -160,8 +159,8 @@ class StackManagerNoPaginationTest(testtools.TestCase):
|
|||||||
limit = 50
|
limit = 50
|
||||||
|
|
||||||
def mock_manager(self):
|
def mock_manager(self):
|
||||||
manager = StackManager(None)
|
manager = stacks.StackManager(None)
|
||||||
manager._list = MagicMock()
|
manager._list = mock.MagicMock()
|
||||||
|
|
||||||
def mock_list(*args, **kwargs):
|
def mock_list(*args, **kwargs):
|
||||||
def results():
|
def results():
|
||||||
@@ -260,8 +259,8 @@ class StackManagerPaginationTest(testtools.TestCase):
|
|||||||
limit = 50
|
limit = 50
|
||||||
|
|
||||||
def mock_manager(self):
|
def mock_manager(self):
|
||||||
manager = StackManager(None)
|
manager = stacks.StackManager(None)
|
||||||
manager._list = MagicMock()
|
manager._list = mock.MagicMock()
|
||||||
|
|
||||||
def mock_list(arg_url, arg_response_key):
|
def mock_list(arg_url, arg_response_key):
|
||||||
try:
|
try:
|
||||||
|
@@ -19,7 +19,7 @@ import six
|
|||||||
from six.moves.urllib import request
|
from six.moves.urllib import request
|
||||||
import tempfile
|
import tempfile
|
||||||
import testtools
|
import testtools
|
||||||
from testtools.matchers import MatchesRegex
|
from testtools import matchers
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from heatclient.common import template_utils
|
from heatclient.common import template_utils
|
||||||
@@ -429,7 +429,7 @@ class TestGetTemplateContents(testtools.TestCase):
|
|||||||
tmpl_file.name)
|
tmpl_file.name)
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
str(ex),
|
str(ex),
|
||||||
MatchesRegex(
|
matchers.MatchesRegex(
|
||||||
'Error parsing template file://%s ' % tmpl_file.name))
|
'Error parsing template file://%s ' % tmpl_file.name))
|
||||||
|
|
||||||
def test_get_template_contents_url(self):
|
def test_get_template_contents_url(self):
|
||||||
|
@@ -15,4 +15,4 @@
|
|||||||
|
|
||||||
__all__ = ['Client']
|
__all__ = ['Client']
|
||||||
|
|
||||||
from heatclient.v1.client import Client
|
from heatclient.v1.client import Client # noqa
|
||||||
|
2
tox.ini
2
tox.ini
@@ -29,7 +29,5 @@ downloadcache = ~/cache/pip
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
show-source = True
|
show-source = True
|
||||||
# H302: Do not import objects, only modules
|
|
||||||
ignore = H302
|
|
||||||
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build
|
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build
|
||||||
max-complexity=20
|
max-complexity=20
|
||||||
|
Reference in New Issue
Block a user