Remove unnecessary string formatting

A sequel to change I3b4506b81cc5e9f04e99cc22bb7e78d0bbf0c48c.

Change-Id: I654941153e8584a2d7c86798a933edf9a5161f48
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2021-02-12 12:44:18 +00:00
parent 63c5f8a9be
commit 7040bf8cc6
12 changed files with 40 additions and 63 deletions

View File

@@ -670,7 +670,6 @@ class NetworkCloudMixin(_normalize.Normalizer):
url = '/quotas/{project_id}'.format(project_id=proj.id)
if details:
url = url + "/details"
url = url + ""
data = proxy._json_response(
self.network.get(url),
error_message=("Error fetching Neutron's quota for "

View File

@@ -178,8 +178,7 @@ class TestDeleteServer(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'floatingips',
'{fip_id}'.format(fip_id=fip_id)])),
append=['v2.0', 'floatingips', fip_id])),
dict(method='GET',
uri=self.get_mock_url(
'network', 'public', append=['v2.0', 'floatingips']),

View File

@@ -299,7 +299,7 @@ class TestNetwork(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'networks', "%s" % network_id]),
append=['v2.0', 'networks', network_id]),
json={})
])
self.assertTrue(self.cloud.delete_network(network_name))
@@ -327,7 +327,7 @@ class TestNetwork(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'networks', "%s" % network_id]),
append=['v2.0', 'networks', network_id]),
status_code=503)
])
self.assertRaises(openstack.cloud.OpenStackCloudException,
@@ -342,7 +342,7 @@ class TestNetwork(base.TestCase):
dict(method='GET',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'networks', "%s" % network_id]),
append=['v2.0', 'networks', network_id]),
json={'network': network})
])
self.assertTrue(self.cloud.get_network_by_id(network_id))

View File

@@ -192,7 +192,7 @@ class TestPort(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'ports', '%s' % port_id]),
append=['v2.0', 'ports', port_id]),
json=self.mock_neutron_port_update_rep,
validate=dict(
json={'port': {'name': 'test-port-name-updated'}}))
@@ -219,7 +219,7 @@ class TestPort(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'ports', '%s' % port_id]),
append=['v2.0', 'ports', port_id]),
status_code=500,
validate=dict(
json={'port': {'name': 'test-port-name-updated'}}))
@@ -311,7 +311,7 @@ class TestPort(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'ports', '%s' % port_id]),
append=['v2.0', 'ports', port_id]),
json={})
])
@@ -353,7 +353,7 @@ class TestPort(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'ports', '%s' % port1['id']]),
append=['v2.0', 'ports', port1['id']]),
json={})
])
self.assertTrue(self.cloud.delete_port(name_or_id=port1['id']))

View File

@@ -86,8 +86,7 @@ class TestQosBandwidthLimitRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'bandwidth_limit_rules',
'%s' % self.rule_id]),
'bandwidth_limit_rules', self.rule_id]),
json={'bandwidth_limit_rule': self.mock_rule})
])
r = self.cloud.get_qos_bandwidth_limit_rule(self.policy_name,
@@ -235,15 +234,13 @@ class TestQosBandwidthLimitRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'bandwidth_limit_rules',
'%s' % self.rule_id]),
'bandwidth_limit_rules', self.rule_id]),
json={'bandwidth_limit_rule': self.mock_rule}),
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'bandwidth_limit_rules',
'%s' % self.rule_id]),
'bandwidth_limit_rules', self.rule_id]),
json={'bandwidth_limit_rule': expected_rule},
validate=dict(
json={'bandwidth_limit_rule': {
@@ -306,14 +303,14 @@ class TestQosBandwidthLimitRule(base.TestCase):
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'bandwidth_limit_rules',
'%s' % self.rule_id]),
self.rule_id]),
json={'bandwidth_limit_rule': self.mock_rule}),
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'bandwidth_limit_rules',
'%s' % self.rule_id]),
self.rule_id]),
json={'bandwidth_limit_rule': expected_rule},
validate=dict(
json={'bandwidth_limit_rule': {
@@ -346,8 +343,7 @@ class TestQosBandwidthLimitRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'bandwidth_limit_rules',
'%s' % self.rule_id]),
'bandwidth_limit_rules', self.rule_id]),
json={})
])
self.assertTrue(
@@ -387,8 +383,7 @@ class TestQosBandwidthLimitRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'bandwidth_limit_rules',
'%s' % self.rule_id]),
'bandwidth_limit_rules', self.rule_id]),
status_code=404)
])
self.assertFalse(

View File

@@ -73,8 +73,7 @@ class TestQosDscpMarkingRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'dscp_marking_rules',
'%s' % self.rule_id]),
'dscp_marking_rules', self.rule_id]),
json={'dscp_marking_rule': self.mock_rule})
])
r = self.cloud.get_qos_dscp_marking_rule(self.policy_name,
@@ -192,15 +191,13 @@ class TestQosDscpMarkingRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'dscp_marking_rules',
'%s' % self.rule_id]),
'dscp_marking_rules', self.rule_id]),
json={'dscp_marking_rule': self.mock_rule}),
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'dscp_marking_rules',
'%s' % self.rule_id]),
'dscp_marking_rules', self.rule_id]),
json={'dscp_marking_rule': expected_rule},
validate=dict(
json={'dscp_marking_rule': {
@@ -244,7 +241,7 @@ class TestQosDscpMarkingRule(base.TestCase):
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'dscp_marking_rules',
'%s' % self.rule_id]),
self.rule_id]),
json={})
])
self.assertTrue(
@@ -284,8 +281,7 @@ class TestQosDscpMarkingRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'dscp_marking_rules',
'%s' % self.rule_id]),
'dscp_marking_rules', self.rule_id]),
status_code=404)
])
self.assertFalse(

View File

@@ -74,8 +74,7 @@ class TestQosMinimumBandwidthRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'minimum_bandwidth_rules',
'%s' % self.rule_id]),
'minimum_bandwidth_rules', self.rule_id]),
json={'minimum_bandwidth_rule': self.mock_rule})
])
r = self.cloud.get_qos_minimum_bandwidth_rule(self.policy_name,
@@ -192,15 +191,13 @@ class TestQosMinimumBandwidthRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'minimum_bandwidth_rules',
'%s' % self.rule_id]),
'minimum_bandwidth_rules', self.rule_id]),
json={'minimum_bandwidth_rule': self.mock_rule}),
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'minimum_bandwidth_rules',
'%s' % self.rule_id]),
'minimum_bandwidth_rules', self.rule_id]),
json={'minimum_bandwidth_rule': expected_rule},
validate=dict(
json={'minimum_bandwidth_rule': {
@@ -243,8 +240,7 @@ class TestQosMinimumBandwidthRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'minimum_bandwidth_rules',
'%s' % self.rule_id]),
'minimum_bandwidth_rules', self.rule_id]),
json={})
])
self.assertTrue(
@@ -284,8 +280,7 @@ class TestQosMinimumBandwidthRule(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies', self.policy_id,
'minimum_bandwidth_rules',
'%s' % self.rule_id]),
'minimum_bandwidth_rules', self.rule_id]),
status_code=404)
])
self.assertFalse(

View File

@@ -155,8 +155,7 @@ class TestQosPolicy(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies',
'%s' % self.policy_id]),
append=['v2.0', 'qos', 'policies', self.policy_id]),
json={})
])
self.assertTrue(self.cloud.delete_qos_policy(self.policy_name))
@@ -236,8 +235,7 @@ class TestQosPolicy(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies',
'%s' % self.policy_id]),
append=['v2.0', 'qos', 'policies', self.policy_id]),
json={})
])
self.assertTrue(self.cloud.delete_qos_policy(policy1['id']))
@@ -263,8 +261,7 @@ class TestQosPolicy(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies',
'%s' % self.policy_id]),
append=['v2.0', 'qos', 'policies', self.policy_id]),
json={'policy': expected_policy},
validate=dict(
json={'policy': {'name': 'goofy'}}))
@@ -310,8 +307,7 @@ class TestQosPolicy(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'policies',
'%s' % self.policy_id]),
append=['v2.0', 'qos', 'policies', self.policy_id]),
json={'policy': expected_policy},
validate=dict(
json={'policy': {'name': "goofy"}}))

View File

@@ -111,7 +111,7 @@ class TestQosRuleType(base.TestCase):
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'qos', 'rule-types',
'%s' % self.rule_type_name]),
self.rule_type_name]),
json={'rule_type': self.mock_rule_type_details})
])
self.assertEqual(

View File

@@ -154,8 +154,7 @@ class TestQuotas(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'quotas',
'%s' % project.project_id]),
append=['v2.0', 'quotas', project.project_id]),
json={},
validate=dict(
json={'quota': {'network': 1}}))
@@ -181,8 +180,7 @@ class TestQuotas(base.TestCase):
dict(method='GET',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'quotas',
'%s' % project.project_id]),
append=['v2.0', 'quotas', project.project_id]),
json={'quota': quota})
])
received_quota = self.cloud.get_network_quotas(project.project_id)
@@ -250,8 +248,7 @@ class TestQuotas(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'quotas',
'%s' % project.project_id]),
append=['v2.0', 'quotas', project.project_id]),
json={})
])
self.cloud.delete_network_quotas(project.project_id)

View File

@@ -274,7 +274,7 @@ class TestRouter(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'routers', '%s' % self.router_id]),
append=['v2.0', 'routers', self.router_id]),
json={'router': expected_router_rep},
validate=dict(
json={'router': {
@@ -295,7 +295,7 @@ class TestRouter(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'routers', '%s' % self.router_id]),
append=['v2.0', 'routers', self.router_id]),
json={})
])
self.assertTrue(self.cloud.delete_router(self.router_name))

View File

@@ -324,7 +324,7 @@ class TestSubnet(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'subnets', '%s' % self.subnet_id]),
append=['v2.0', 'subnets', self.subnet_id]),
json={})
])
self.assertTrue(self.cloud.delete_subnet(self.subnet_name))
@@ -365,7 +365,7 @@ class TestSubnet(base.TestCase):
dict(method='DELETE',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'subnets', '%s' % subnet1['id']]),
append=['v2.0', 'subnets', subnet1['id']]),
json={})
])
self.assertTrue(self.cloud.delete_subnet(subnet1['id']))
@@ -382,7 +382,7 @@ class TestSubnet(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'subnets', '%s' % self.subnet_id]),
append=['v2.0', 'subnets', self.subnet_id]),
json={'subnet': expected_subnet},
validate=dict(
json={'subnet': {'name': 'goofy'}}))
@@ -403,7 +403,7 @@ class TestSubnet(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'subnets', '%s' % self.subnet_id]),
append=['v2.0', 'subnets', self.subnet_id]),
json={'subnet': expected_subnet},
validate=dict(
json={'subnet': {'gateway_ip': gateway}}))
@@ -423,7 +423,7 @@ class TestSubnet(base.TestCase):
dict(method='PUT',
uri=self.get_mock_url(
'network', 'public',
append=['v2.0', 'subnets', '%s' % self.subnet_id]),
append=['v2.0', 'subnets', self.subnet_id]),
json={'subnet': expected_subnet},
validate=dict(
json={'subnet': {'gateway_ip': None}}))