Skip to content

Commit 495116e

Browse files
committed
Refactor test cases in get_azure_lb_test.py to streamline frontend_ip_configurations initialization
1 parent 9ba6b87 commit 495116e

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

tests/modules/get_azure_lb_test.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,12 @@ def test_load_balancer_missing_private_ip(self, mocker):
128128
:param mocker: Mocking library for Python.
129129
:type mocker: _mocker.MagicMock
130130
"""
131+
131132
class LBWithoutPrivateIP:
132133
def __init__(self):
133134
self.name = "public-lb"
134135
self.location = "test"
135-
self.frontend_ip_configurations = [
136-
{"public_ip_address": "1.2.3.4"}
137-
]
136+
self.frontend_ip_configurations = [{"public_ip_address": "1.2.3.4"}]
138137
self.load_balancing_rules = []
139138
self.probes = []
140139

@@ -151,6 +150,7 @@ def as_dict(self):
151150
patched_client.return_value.load_balancers.list_all.return_value = [
152151
LBWithoutPrivateIP(),
153152
LoadBalancer("test", "127.0.0.1"),
153+
]
154154

155155
azure_lb = AzureLoadBalancer(
156156
module_params={
@@ -185,13 +185,12 @@ def test_load_balancer_camelcase_ip_address(self, mocker):
185185
:param mocker: Mocking library for Python.
186186
:type mocker: _mocker.MagicMock
187187
"""
188+
188189
class LBWithCamelCase:
189190
def __init__(self):
190191
self.name = "camelcase-lb"
191192
self.location = "test"
192-
self.frontend_ip_configurations = [
193-
{"privateIpAddress": "192.168.1.1"}
194-
]
193+
self.frontend_ip_configurations = [{"privateIpAddress": "192.168.1.1"}]
195194
self.load_balancing_rules = []
196195
self.probes = []
197196

@@ -242,16 +241,13 @@ def test_load_balancer_nested_properties(self, mocker):
242241
:param mocker: Mocking library for Python.
243242
:type mocker: _mocker.MagicMock
244243
"""
244+
245245
class LBWithNestedProperties:
246246
def __init__(self):
247247
self.name = "nested-lb"
248248
self.location = "test"
249249
self.frontend_ip_configurations = [
250-
{
251-
"properties": {
252-
"private_ip_address": "10.0.0.5"
253-
}
254-
}
250+
{"properties": {"private_ip_address": "10.0.0.5"}}
255251
]
256252
self.load_balancing_rules = []
257253
self.probes = []

0 commit comments

Comments
 (0)