Fix [H302] errors in contrib

Change-Id: I356753e791e574ee45b3b254aaeb80b242e13b23
This commit is contained in:
Peter Razumovsky 2014-11-13 14:50:20 +03:00
parent f39600e28b
commit 16fc1fff93
3 changed files with 18 additions and 17 deletions

View File

@ -24,10 +24,10 @@ from heat.engine import scheduler
from heat.tests import common
from heat.tests import utils
from testtools import skipIf
import testtools
from ..resources import docker_container # noqa
from .fake_docker_client import FakeDockerClient # noqa
import fake_docker_client as fakeclient # noqa
docker = importutils.try_import('docker')
@ -67,7 +67,8 @@ class DockerContainerTest(common.HeatTestCase):
resource_name,
stack.t.resource_definitions(stack)[resource_name], stack)
self.m.StubOutWithMock(resource, 'get_client')
resource.get_client().MultipleTimes().AndReturn(FakeDockerClient())
resource.get_client().MultipleTimes().AndReturn(
fakeclient.FakeDockerClient())
self.assertIsNone(resource.validate())
self.m.ReplayAll()
scheduler.TaskRunner(resource.create)()
@ -96,7 +97,8 @@ class DockerContainerTest(common.HeatTestCase):
resource = docker_container.DockerContainer(
'Blog', definition, stack)
self.m.StubOutWithMock(resource, 'get_client')
resource.get_client().MultipleTimes().AndReturn(FakeDockerClient())
resource.get_client().MultipleTimes().AndReturn(
fakeclient.FakeDockerClient())
self.assertIsNone(resource.validate())
self.m.ReplayAll()
scheduler.TaskRunner(resource.create)()
@ -116,7 +118,8 @@ class DockerContainerTest(common.HeatTestCase):
resource = docker_container.DockerContainer(
'Blog', definition, stack)
self.m.StubOutWithMock(resource, 'get_client')
resource.get_client().MultipleTimes().AndReturn(FakeDockerClient())
resource.get_client().MultipleTimes().AndReturn(
fakeclient.FakeDockerClient())
self.assertIsNone(resource.validate())
self.m.ReplayAll()
scheduler.TaskRunner(resource.create)()
@ -160,7 +163,7 @@ class DockerContainerTest(common.HeatTestCase):
scheduler.TaskRunner(container.delete)()
self.m.VerifyAll()
@skipIf(docker is None, 'docker-py not available')
@testtools.skipIf(docker is None, 'docker-py not available')
def test_resource_delete_exception(self):
response = mock.MagicMock()
response.status_code = 404

View File

@ -19,8 +19,7 @@ from heat.engine import template
from heat.tests import common
from heat.tests import utils
from ..resources.nova_flavor import NovaFlavor # noqa
from ..resources.nova_flavor import resource_mapping # noqa
from ..resources import nova_flavor # noqa
from heat.tests.v1_1 import fakes
flavor_template = {
@ -50,7 +49,7 @@ class NovaFlavorTest(common.HeatTestCase):
# For unit testing purpose. Register resource provider
# explicitly.
resource._register_class("OS::Nova::Flavor", NovaFlavor)
resource._register_class("OS::Nova::Flavor", nova_flavor.NovaFlavor)
self.stack = parser.Stack(
self.ctx, 'nova_flavor_test_stack',
@ -65,10 +64,10 @@ class NovaFlavorTest(common.HeatTestCase):
self.flavors = self.novaclient.flavors
def test_resource_mapping(self):
mapping = resource_mapping()
mapping = nova_flavor.resource_mapping()
self.assertEqual(1, len(mapping))
self.assertEqual(NovaFlavor, mapping['OS::Nova::Flavor'])
self.assertIsInstance(self.my_flavor, NovaFlavor)
self.assertEqual(nova_flavor.NovaFlavor, mapping['OS::Nova::Flavor'])
self.assertIsInstance(self.my_flavor, nova_flavor.NovaFlavor)
def test_flavor_handle_create(self):
value = mock.MagicMock()

View File

@ -23,7 +23,6 @@ from heat.engine import attributes
from heat.engine import constraints
from heat.engine import function
from heat.engine import properties
from heat.engine.properties import Properties
from heat.engine import resource
from heat.engine import scheduler
from heat.openstack.common import log as logging
@ -633,10 +632,10 @@ class CloudLoadBalancer(resource.Resource):
if health_monitor[self.HEALTH_MONITOR_TYPE] == 'CONNECT':
schema = dict((k, v) for k, v in schema.items()
if k in self._HEALTH_MONITOR_CONNECT_KEYS)
Properties(schema,
health_monitor,
function.resolve,
self.name).validate()
properties.Properties(schema,
health_monitor,
function.resolve,
self.name).validate()
# if a vip specifies and id, it can't specify version or type;
# otherwise version and type are required