Merge "Clean up FakeClient classes in volume fakes"

This commit is contained in:
Jenkins 2016-09-06 14:03:38 +00:00 committed by Gerrit Code Review
commit 55378953e2
6 changed files with 10 additions and 78 deletions

View File

@ -129,25 +129,6 @@ QOS_WITH_ASSOCIATIONS = {
} }
class FakeTransferClient(object):
def __init__(self, **kwargs):
self.transfers = mock.Mock()
self.transfers.resource_class = fakes.FakeResource(None, {})
class TestTransfer(utils.TestCommand):
def setUp(self):
super(TestTransfer, self).setUp()
self.app.client_manager.volume = FakeTransferClient(
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN
)
class FakeTransfer(object): class FakeTransfer(object):
"""Fake one or more Transfer.""" """Fake one or more Transfer."""
@ -180,24 +161,6 @@ class FakeTransfer(object):
return transfer return transfer
class FakeServiceClient(object):
def __init__(self, **kwargs):
self.services = mock.Mock()
self.services.resource_class = fakes.FakeResource(None, {})
class TestService(utils.TestCommand):
def setUp(self):
super(TestService, self).setUp()
self.app.client_manager.volume = FakeServiceClient(
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN
)
class FakeService(object): class FakeService(object):
"""Fake one or more Services.""" """Fake one or more Services."""
@ -290,6 +253,8 @@ class FakeVolumev1Client(object):
self.qos_specs.resource_class = fakes.FakeResource(None, {}) self.qos_specs.resource_class = fakes.FakeResource(None, {})
self.volume_types = mock.Mock() self.volume_types = mock.Mock()
self.volume_types.resource_class = fakes.FakeResource(None, {}) self.volume_types.resource_class = fakes.FakeResource(None, {})
self.transfers = mock.Mock()
self.transfers.resource_class = fakes.FakeResource(None, {})
self.auth_token = kwargs['token'] self.auth_token = kwargs['token']
self.management_url = kwargs['endpoint'] self.management_url = kwargs['endpoint']

View File

@ -18,7 +18,7 @@ from openstackclient.tests.volume.v1 import fakes as service_fakes
from openstackclient.volume.v1 import service from openstackclient.volume.v1 import service
class TestService(service_fakes.TestService): class TestService(service_fakes.TestVolumev1):
def setUp(self): def setUp(self):
super(TestService, self).setUp() super(TestService, self).setUp()

View File

@ -17,7 +17,7 @@ from openstackclient.tests.volume.v1 import fakes as transfer_fakes
from openstackclient.volume.v1 import volume_transfer_request from openstackclient.volume.v1 import volume_transfer_request
class TestTransfer(transfer_fakes.TestTransfer): class TestTransfer(transfer_fakes.TestVolumev1):
def setUp(self): def setUp(self):
super(TestTransfer, self).setUp() super(TestTransfer, self).setUp()

View File

@ -25,25 +25,6 @@ from openstackclient.tests.image.v2 import fakes as image_fakes
from openstackclient.tests import utils from openstackclient.tests import utils
class FakeTransferClient(object):
def __init__(self, **kwargs):
self.transfers = mock.Mock()
self.transfers.resource_class = fakes.FakeResource(None, {})
class TestTransfer(utils.TestCommand):
def setUp(self):
super(TestTransfer, self).setUp()
self.app.client_manager.volume = FakeTransferClient(
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN
)
class FakeTransfer(object): class FakeTransfer(object):
"""Fake one or more Transfer.""" """Fake one or more Transfer."""
@ -108,24 +89,6 @@ class FakeTypeAccess(object):
return type_access return type_access
class FakeServiceClient(object):
def __init__(self, **kwargs):
self.services = mock.Mock()
self.services.resource_class = fakes.FakeResource(None, {})
class TestService(utils.TestCommand):
def setUp(self):
super(TestService, self).setUp()
self.app.client_manager.volume = FakeServiceClient(
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN
)
class FakeService(object): class FakeService(object):
"""Fake one or more Services.""" """Fake one or more Services."""
@ -200,6 +163,10 @@ class FakeVolumeClient(object):
self.qos_specs.resource_class = fakes.FakeResource(None, {}) self.qos_specs.resource_class = fakes.FakeResource(None, {})
self.availability_zones = mock.Mock() self.availability_zones = mock.Mock()
self.availability_zones.resource_class = fakes.FakeResource(None, {}) self.availability_zones.resource_class = fakes.FakeResource(None, {})
self.transfers = mock.Mock()
self.transfers.resource_class = fakes.FakeResource(None, {})
self.services = mock.Mock()
self.services.resource_class = fakes.FakeResource(None, {})
self.auth_token = kwargs['token'] self.auth_token = kwargs['token']
self.management_url = kwargs['endpoint'] self.management_url = kwargs['endpoint']

View File

@ -18,7 +18,7 @@ from openstackclient.tests.volume.v2 import fakes as service_fakes
from openstackclient.volume.v2 import service from openstackclient.volume.v2 import service
class TestService(service_fakes.TestService): class TestService(service_fakes.TestVolume):
def setUp(self): def setUp(self):
super(TestService, self).setUp() super(TestService, self).setUp()

View File

@ -17,7 +17,7 @@ from openstackclient.tests.volume.v2 import fakes as transfer_fakes
from openstackclient.volume.v2 import volume_transfer_request from openstackclient.volume.v2 import volume_transfer_request
class TestTransfer(transfer_fakes.TestTransfer): class TestTransfer(transfer_fakes.TestVolume):
def setUp(self): def setUp(self):
super(TestTransfer, self).setUp() super(TestTransfer, self).setUp()