Skip to content

Commit 4038391

Browse files
author
anushkasingh16
committed
adding mocks for localdns update command
1 parent ad45bfc commit 4038391

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/aks-preview/azext_aks_preview/tests/latest/test_update_agentpool_profile_preview.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def test_update_agentpool_profile_preview_default_behavior(self):
129129
decorator.update_os_sku = Mock(return_value=agentpool)
130130
decorator.update_fips_image = Mock(return_value=agentpool)
131131
decorator.update_ssh_access = Mock(return_value=agentpool)
132+
decorator.update_localdns_profile = Mock(return_value=agentpool)
132133

133134
# Act
134135
result = decorator.update_agentpool_profile_preview()
@@ -148,6 +149,7 @@ def test_update_agentpool_profile_preview_default_behavior(self):
148149
decorator.update_os_sku.assert_called_once_with(agentpool)
149150
decorator.update_fips_image.assert_called_once_with(agentpool)
150151
decorator.update_ssh_access.assert_called_once_with(agentpool)
152+
decorator.update_localdns_profile.assert_called_once_with(agentpool)
151153

152154
def test_update_agentpool_profile_preview_with_agentpools_parameter(self):
153155
"""Test update_agentpool_profile_preview with agentpools parameter."""
@@ -185,6 +187,7 @@ def test_update_agentpool_profile_preview_with_agentpools_parameter(self):
185187
decorator.update_os_sku = Mock(return_value=agentpool)
186188
decorator.update_fips_image = Mock(return_value=agentpool)
187189
decorator.update_ssh_access = Mock(return_value=agentpool)
190+
decorator.update_localdns_profile = Mock(return_value=agentpool)
188191

189192
# Act
190193
result = decorator.update_agentpool_profile_preview(agentpools)
@@ -233,6 +236,7 @@ def test_update_agentpool_profile_preview_managed_system_mode(self):
233236
decorator.update_os_sku = Mock()
234237
decorator.update_fips_image = Mock()
235238
decorator.update_ssh_access = Mock()
239+
decorator.update_localdns_profile = Mock()
236240

237241
# Act
238242
result = decorator.update_agentpool_profile_preview()
@@ -258,6 +262,7 @@ def test_update_agentpool_profile_preview_managed_system_mode(self):
258262
decorator.update_os_sku.assert_not_called()
259263
decorator.update_fips_image.assert_not_called()
260264
decorator.update_ssh_access.assert_not_called()
265+
decorator.update_localdns_profile.assert_not_called()
261266

262267
def test_update_agentpool_profile_preview_managed_system_mode_with_agentpools(self):
263268
"""Test update_agentpool_profile_preview with ManagedSystem mode and agentpools parameter."""
@@ -333,6 +338,7 @@ def test_update_agentpool_profile_preview_system_mode_regular_flow(self):
333338
decorator.update_os_sku = Mock(return_value=agentpool)
334339
decorator.update_fips_image = Mock(return_value=agentpool)
335340
decorator.update_ssh_access = Mock(return_value=agentpool)
341+
decorator.update_localdns_profile = Mock(return_value=agentpool)
336342

337343
# Act
338344
result = decorator.update_agentpool_profile_preview()
@@ -350,6 +356,7 @@ def test_update_agentpool_profile_preview_system_mode_regular_flow(self):
350356
decorator.update_os_sku.assert_called_once_with(agentpool)
351357
decorator.update_fips_image.assert_called_once_with(agentpool)
352358
decorator.update_ssh_access.assert_called_once_with(agentpool)
359+
decorator.update_localdns_profile.assert_called_once_with(agentpool)
353360

354361
def test_update_agentpool_profile_preview_execution_order(self):
355362
"""Test that update methods are called in the correct order."""
@@ -392,6 +399,7 @@ def mock_method(pool):
392399
decorator.update_os_sku = create_mock_update_method("update_os_sku")
393400
decorator.update_fips_image = create_mock_update_method("update_fips_image")
394401
decorator.update_ssh_access = create_mock_update_method("update_ssh_access")
402+
decorator.update_localdns_profile = create_mock_update_method("update_localdns_profile")
395403

396404
# Act
397405
decorator.update_agentpool_profile_preview()
@@ -406,6 +414,7 @@ def mock_method(pool):
406414
"update_os_sku",
407415
"update_fips_image",
408416
"update_ssh_access",
417+
"update_localdns_profile"
409418
]
410419
self.assertEqual(call_order, expected_order)
411420

@@ -450,6 +459,7 @@ def track_and_return(pool):
450459
decorator.update_os_sku = create_tracking_mock("update_os_sku")
451460
decorator.update_fips_image = create_tracking_mock("update_fips_image")
452461
decorator.update_ssh_access = create_tracking_mock("update_ssh_access")
462+
decorator.update_localdns_profile = create_tracking_mock("update_localdns_profile")
453463

454464
# Act
455465
result = decorator.update_agentpool_profile_preview()
@@ -511,7 +521,7 @@ def test_update_agentpool_profile_preview_mixed_modes_scenario(self):
511521
update_methods = [
512522
'update_custom_ca_trust', 'update_network_profile', 'update_artifact_streaming',
513523
'update_secure_boot', 'update_vtpm', 'update_os_sku', 'update_fips_image',
514-
'update_ssh_access'
524+
'update_ssh_access', 'update_localdns_profile'
515525
]
516526

517527
for method_name in update_methods:
@@ -580,6 +590,7 @@ def test_update_agentpool_profile_preview_managed_cluster_mode(self):
580590
decorator.update_os_sku = Mock(return_value=agentpool)
581591
decorator.update_fips_image = Mock(return_value=agentpool)
582592
decorator.update_ssh_access = Mock(return_value=agentpool)
593+
decorator.update_localdns_profile = Mock(return_value=agentpool)
583594

584595
# Act
585596
result = decorator.update_agentpool_profile_preview(agentpools)

0 commit comments

Comments
 (0)