Skip to content

Commit 4c60d34

Browse files
committed
tests: Remove unused fakes
These should have all been migrated when the commands were moved from cinderclient to SDK. Change-Id: I79730cd789d3adf78f4655d138c68cff1d046a5b Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent afc5135 commit 4c60d34

6 files changed

Lines changed: 22 additions & 425 deletions

File tree

openstackclient/tests/unit/compute/v2/fakes.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,6 @@ def create_one_agent(attrs=None):
104104
return agent_attrs
105105

106106

107-
def create_agents(attrs=None, count=2):
108-
"""Create multiple fake agents.
109-
110-
:param dict attrs: A dictionary with all attributes
111-
:param int count: The number of agents to fake
112-
:return: A list of dictionaries faking the agents
113-
"""
114-
agents = []
115-
for i in range(0, count):
116-
agents.append(create_one_agent(attrs))
117-
118-
return agents
119-
120-
121107
def create_one_extension(attrs=None):
122108
"""Create a fake extension.
123109
@@ -352,20 +338,6 @@ def create_one_flavor(attrs=None):
352338
return flavor
353339

354340

355-
def create_flavors(attrs=None, count=2):
356-
"""Create multiple fake flavors.
357-
358-
:param dict attrs: A dictionary with all attributes
359-
:param int count: The number of flavors to fake
360-
:return: A list of fake :class:`openstack.compute.v2.flavor.Flavor` objects
361-
"""
362-
flavors = []
363-
for i in range(0, count):
364-
flavors.append(create_one_flavor(attrs))
365-
366-
return flavors
367-
368-
369341
def create_one_flavor_access(attrs=None):
370342
"""Create a fake flavor access.
371343
@@ -499,19 +471,6 @@ def create_one_floating_ip_pool(attrs=None):
499471
return floating_ip_pool_attrs
500472

501473

502-
def create_floating_ip_pools(attrs=None, count=2):
503-
"""Create multiple fake floating IP pools.
504-
505-
:param dict attrs: A dictionary with all attributes
506-
:param int count: The number of floating IP pools to fake
507-
:return: A list of dictionaries faking the floating IP pools
508-
"""
509-
floating_ip_pools = []
510-
for i in range(0, count):
511-
floating_ip_pools.append(create_one_floating_ip_pool(attrs))
512-
return floating_ip_pools
513-
514-
515474
def create_one_network(attrs=None):
516475
"""Create a fake network.
517476
@@ -730,21 +689,6 @@ def create_one_server_migration(attrs=None):
730689
return migration
731690

732691

733-
def create_server_migrations(attrs=None, methods=None, count=2):
734-
"""Create multiple server migrations.
735-
736-
:param dict attrs: A dictionary with all attributes
737-
:param int count: The number of server migrations to fake
738-
:return A list of fake
739-
openstack.compute.v2.server_migration.ServerMigration objects
740-
"""
741-
migrations = []
742-
for i in range(0, count):
743-
migrations.append(create_one_server_migration(attrs, methods))
744-
745-
return migrations
746-
747-
748692
def create_one_volume_attachment(attrs=None):
749693
"""Create a fake volume attachment.
750694

openstackclient/tests/unit/identity/v2_0/fakes.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,10 @@ def __init__(self, **kwargs):
167167
self.tokens.resource_class = fakes.FakeResource(None, {})
168168
self.users = mock.Mock()
169169
self.users.resource_class = fakes.FakeResource(None, {})
170-
self.ec2 = mock.Mock()
171-
self.ec2.resource_class = fakes.FakeResource(None, {})
172170
self.endpoints = mock.Mock()
173171
self.endpoints.resource_class = fakes.FakeResource(None, {})
174172
self.extensions = mock.Mock()
175173
self.extensions.resource_class = fakes.FakeResource(None, {})
176-
self.auth_token = kwargs['token']
177-
self.management_url = kwargs['endpoint']
178174

179175
def __getattr__(self, name):
180176
# Map v3 'projects' back to v2 'tenants'

openstackclient/tests/unit/identity/v3/fakes.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,6 @@ class FakeIdentityClient:
582582
def __init__(self, **kwargs):
583583
self.domains = mock.Mock()
584584
self.domains.resource_class = fakes.FakeResource(None, {})
585-
self.credentials = mock.Mock()
586-
self.credentials.resource_class = fakes.FakeResource(None, {})
587585
self.endpoints = mock.Mock()
588586
self.endpoints.resource_class = fakes.FakeResource(None, {})
589587
self.endpoint_filter = mock.Mock()
@@ -596,24 +594,14 @@ def __init__(self, **kwargs):
596594
self.oauth1.resource_class = fakes.FakeResource(None, {})
597595
self.projects = mock.Mock()
598596
self.projects.resource_class = fakes.FakeResource(None, {})
599-
self.regions = mock.Mock()
600-
self.regions.resource_class = fakes.FakeResource(None, {})
601597
self.roles = mock.Mock()
602598
self.roles.resource_class = fakes.FakeResource(None, {})
603599
self.services = mock.Mock()
604600
self.services.resource_class = fakes.FakeResource(None, {})
605-
self.session = mock.Mock()
606-
self.session.auth.auth_ref.service_catalog.resource_class = (
607-
fakes.FakeResource(None, {})
608-
)
609601
self.tokens = mock.Mock()
610602
self.tokens.resource_class = fakes.FakeResource(None, {})
611-
self.trusts = mock.Mock()
612-
self.trusts.resource_class = fakes.FakeResource(None, {})
613603
self.users = mock.Mock()
614604
self.users.resource_class = fakes.FakeResource(None, {})
615-
self.role_assignments = mock.Mock()
616-
self.role_assignments.resource_class = fakes.FakeResource(None, {})
617605
self.auth_token = kwargs['token']
618606
self.management_url = kwargs['endpoint']
619607
self.auth = FakeAuth()
@@ -623,30 +611,16 @@ def __init__(self, **kwargs):
623611
self.application_credentials.resource_class = fakes.FakeResource(
624612
None, {}
625613
)
626-
self.access_rules = mock.Mock()
627-
self.access_rules.resource_class = fakes.FakeResource(None, {})
628614
self.inference_rules = mock.Mock()
629615
self.inference_rules.resource_class = fakes.FakeResource(None, {})
630-
self.registered_limits = mock.Mock()
631-
self.registered_limits.resource_class = fakes.FakeResource(None, {})
632-
self.limits = mock.Mock()
633-
self.limits.resource_class = fakes.FakeResource(None, {})
634616

635617

636618
class FakeFederationManager:
637619
def __init__(self, **kwargs):
638-
self.identity_providers = mock.Mock()
639-
self.identity_providers.resource_class = fakes.FakeResource(None, {})
640-
self.mappings = mock.Mock()
641-
self.mappings.resource_class = fakes.FakeResource(None, {})
642-
self.protocols = mock.Mock()
643-
self.protocols.resource_class = fakes.FakeResource(None, {})
644620
self.projects = mock.Mock()
645621
self.projects.resource_class = fakes.FakeResource(None, {})
646622
self.domains = mock.Mock()
647623
self.domains.resource_class = fakes.FakeResource(None, {})
648-
self.service_providers = mock.Mock()
649-
self.service_providers.resource_class = fakes.FakeResource(None, {})
650624

651625

652626
class FakeFederatedClient(FakeIdentityClient):
@@ -659,13 +633,6 @@ class FakeOAuth1Client(FakeIdentityClient):
659633
def __init__(self, **kwargs):
660634
super().__init__(**kwargs)
661635

662-
self.access_tokens = mock.Mock()
663-
self.access_tokens.resource_class = fakes.FakeResource(None, {})
664-
self.consumers = mock.Mock()
665-
self.consumers.resource_class = fakes.FakeResource(None, {})
666-
self.request_tokens = mock.Mock()
667-
self.request_tokens.resource_class = fakes.FakeResource(None, {})
668-
669636

670637
class FakeClientMixin:
671638
def setUp(self):

openstackclient/tests/unit/network/v2/fakes.py

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,25 +1314,6 @@ def create_network_agents(attrs=None, count=2):
13141314
return agents
13151315

13161316

1317-
def get_network_agents(agents=None, count=2):
1318-
"""Get an iterable Mock object with a list of faked network agents.
1319-
1320-
If network agents list is provided, then initialize the Mock object
1321-
with the list. Otherwise create one.
1322-
1323-
:param List agents:
1324-
A list of Agent objects faking network agents
1325-
:param int count:
1326-
The number of network agents to fake
1327-
:return:
1328-
An iterable Mock object with side_effect set to a list of faked
1329-
network agents
1330-
"""
1331-
if agents is None:
1332-
agents = create_network_agents(count)
1333-
return mock.Mock(side_effect=agents)
1334-
1335-
13361317
def create_one_network_rbac(attrs=None):
13371318
"""Create a fake network rbac
13381319
@@ -1967,26 +1948,6 @@ def create_local_ip_associations(attrs=None, count=2):
19671948
return local_ip_associations
19681949

19691950

1970-
def get_local_ip_associations(local_ip_associations=None, count=2):
1971-
"""Get a list of faked local ip associations
1972-
1973-
If local ip association list is provided, then initialize
1974-
the Mock object with the list. Otherwise create one.
1975-
1976-
:param List local_ip_associations:
1977-
A list of FakeResource objects faking local ip associations
1978-
:param int count:
1979-
The number of local ip associations to fake
1980-
:return:
1981-
An iterable Mock object with side_effect set to a list of faked
1982-
local ip associations
1983-
"""
1984-
if local_ip_associations is None:
1985-
local_ip_associations = create_local_ip_associations(count)
1986-
1987-
return mock.Mock(side_effect=local_ip_associations)
1988-
1989-
19901951
def create_one_ndp_proxy(attrs=None):
19911952
"""Create a fake NDP proxy.
19921953
@@ -2032,25 +1993,6 @@ def create_ndp_proxies(attrs=None, count=2):
20321993
return ndp_proxies
20331994

20341995

2035-
def get_ndp_proxies(ndp_proxies=None, count=2):
2036-
"""Get a list of faked NDP proxies.
2037-
2038-
If ndp_proxy list is provided, then initialize the Mock object
2039-
with the list. Otherwise create one.
2040-
2041-
:param List ndp_proxies:
2042-
A list of FakeResource objects faking ndp proxy
2043-
:param int count:
2044-
The number of ndp proxy to fake
2045-
:return:
2046-
An iterable Mock object with side_effect set to a list of faked
2047-
ndp proxy
2048-
"""
2049-
if ndp_proxies is None:
2050-
ndp_proxies = create_ndp_proxies(count)
2051-
return mock.Mock(side_effect=ndp_proxies)
2052-
2053-
20541996
def create_one_trunk(attrs=None):
20551997
"""Create a fake trunk.
20561998
@@ -2101,22 +2043,3 @@ def create_trunks(attrs=None, count=2):
21012043
trunks.append(create_one_trunk(attrs))
21022044

21032045
return trunks
2104-
2105-
2106-
def get_trunks(trunks=None, count=2):
2107-
"""Get an iterable Mock object with a list of faked trunks.
2108-
2109-
If trunk list is provided, then initialize the Mock object
2110-
with the list. Otherwise create one.
2111-
2112-
:param List trunks:
2113-
A list of FakeResource objects faking trunks
2114-
:param int count:
2115-
The number of trunks to fake
2116-
:return:
2117-
An iterable Mock object with side_effect set to a list of faked
2118-
trunks
2119-
"""
2120-
if trunks is None:
2121-
trunks = create_trunks(count)
2122-
return mock.Mock(side_effect=trunks)

0 commit comments

Comments
 (0)