Use list comprehension in create_bulk_networks
There is no need to pass size of list to create_bulk_networks in
network_client_base since it can be implemented with list comprehension.
Change-Id: I7eb8c7725d9569ad7c2fe853b72a51d10fe65bd1
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index ac3a072..28e1676 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -312,7 +312,7 @@
# Creates 2 networks in one request
network_names = [data_utils.rand_name('network-'),
data_utils.rand_name('network-')]
- resp, body = self.client.create_bulk_network(2, network_names)
+ resp, body = self.client.create_bulk_network(network_names)
created_networks = body['networks']
self.assertEqual('201', resp['status'])
self.addCleanup(self._delete_networks, created_networks)
diff --git a/tempest/services/network/network_client_base.py b/tempest/services/network/network_client_base.py
index 4ee8302..e29f1b5 100644
--- a/tempest/services/network/network_client_base.py
+++ b/tempest/services/network/network_client_base.py
@@ -174,10 +174,8 @@
raise AttributeError(name)
# Common methods that are hard to automate
- def create_bulk_network(self, count, names):
- network_list = list()
- for i in range(count):
- network_list.append({'name': names[i]})
+ def create_bulk_network(self, names):
+ network_list = [{'name': name} for name in names]
post_data = {'networks': network_list}
body = self.serialize_list(post_data, "networks", "network")
uri = self.get_uri("networks")