@@ -52,6 +52,10 @@ def test_complete_script_execution_with_mock_nautobot_responses(
52
52
53
53
# Mock NetAppManager
54
54
mock_netapp_manager_instance = Mock ()
55
+ # Mock the config property to return a proper config object
56
+ mock_config = Mock ()
57
+ mock_config .netapp_nic_slot_prefix = "e4"
58
+ mock_netapp_manager_instance .config = mock_config
55
59
mock_netapp_manager_instance .create_routes_for_project .return_value = []
56
60
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
57
61
@@ -132,6 +136,10 @@ def test_output_format_validation_structured_data(
132
136
133
137
# Mock NetAppManager
134
138
mock_netapp_manager_instance = Mock ()
139
+ # Mock the config property to return a proper config object
140
+ mock_config = Mock ()
141
+ mock_config .netapp_nic_slot_prefix = "e4"
142
+ mock_netapp_manager_instance .config = mock_config
135
143
mock_netapp_manager_instance .create_routes_for_project .return_value = []
136
144
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
137
145
@@ -214,6 +222,10 @@ def test_exit_code_scenario_connection_error(
214
222
215
223
# Mock NetAppManager
216
224
mock_netapp_manager_instance = Mock ()
225
+ # Mock the config property to return a proper config object
226
+ mock_config = Mock ()
227
+ mock_config .netapp_nic_slot_prefix = "e4"
228
+ mock_netapp_manager_instance .config = mock_config
217
229
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
218
230
219
231
# Mock Nautobot client to raise connection error
@@ -260,6 +272,10 @@ def test_exit_code_scenario_graphql_error(
260
272
261
273
# Mock NetAppManager
262
274
mock_netapp_manager_instance = Mock ()
275
+ # Mock the config property to return a proper config object
276
+ mock_config = Mock ()
277
+ mock_config .netapp_nic_slot_prefix = "e4"
278
+ mock_netapp_manager_instance .config = mock_config
263
279
mock_netapp_manager_instance .create_routes_for_project .return_value = []
264
280
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
265
281
@@ -311,6 +327,10 @@ def test_exit_code_scenario_data_validation_error(
311
327
312
328
# Mock NetAppManager
313
329
mock_netapp_manager_instance = Mock ()
330
+ # Mock the config property to return a proper config object
331
+ mock_config = Mock ()
332
+ mock_config .netapp_nic_slot_prefix = "e4"
333
+ mock_netapp_manager_instance .config = mock_config
314
334
mock_netapp_manager_instance .create_routes_for_project .return_value = []
315
335
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
316
336
@@ -360,6 +380,10 @@ def test_exit_code_scenario_success_with_empty_results(
360
380
361
381
# Mock NetAppManager
362
382
mock_netapp_manager_instance = Mock ()
383
+ # Mock the config property to return a proper config object
384
+ mock_config = Mock ()
385
+ mock_config .netapp_nic_slot_prefix = "e4"
386
+ mock_netapp_manager_instance .config = mock_config
363
387
mock_netapp_manager_instance .create_routes_for_project .return_value = []
364
388
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
365
389
@@ -478,6 +502,10 @@ def test_end_to_end_workflow_with_various_input_combinations(
478
502
479
503
# Mock NetAppManager
480
504
mock_netapp_manager_instance = Mock ()
505
+ # Mock the config property to return a proper config object
506
+ mock_config = Mock ()
507
+ mock_config .netapp_nic_slot_prefix = "e4"
508
+ mock_netapp_manager_instance .config = mock_config
481
509
mock_netapp_manager_instance .create_routes_for_project .return_value = []
482
510
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
483
511
@@ -562,6 +590,10 @@ def test_complete_script_execution_with_netapp_interface_creation(
562
590
563
591
# Mock NetAppManager
564
592
mock_netapp_manager_instance = Mock ()
593
+ # Mock the config property to return a proper config object
594
+ mock_config = Mock ()
595
+ mock_config .netapp_nic_slot_prefix = "e4"
596
+ mock_netapp_manager_instance .config = mock_config
565
597
mock_netapp_manager_instance .create_routes_for_project .return_value = []
566
598
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
567
599
@@ -641,6 +673,10 @@ def test_script_execution_with_custom_netapp_config_path(
641
673
642
674
# Mock NetAppManager
643
675
mock_netapp_manager_instance = Mock ()
676
+ # Mock the config property to return a proper config object
677
+ mock_config = Mock ()
678
+ mock_config .netapp_nic_slot_prefix = "e4"
679
+ mock_netapp_manager_instance .config = mock_config
644
680
mock_netapp_manager_instance .create_routes_for_project .return_value = []
645
681
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
646
682
@@ -713,6 +749,10 @@ def test_script_handles_netapp_lif_creation_error(
713
749
714
750
# Mock NetAppManager that raises exception during LIF creation
715
751
mock_netapp_manager_instance = Mock ()
752
+ # Mock the config property to return a proper config object
753
+ mock_config = Mock ()
754
+ mock_config .netapp_nic_slot_prefix = "e4"
755
+ mock_netapp_manager_instance .config = mock_config
716
756
mock_netapp_manager_instance .create_lif .side_effect = Exception (
717
757
"SVM not found for project"
718
758
)
@@ -779,6 +819,10 @@ def test_script_execution_with_empty_vm_results_skips_netapp_creation(
779
819
780
820
# Mock NetAppManager
781
821
mock_netapp_manager_instance = Mock ()
822
+ # Mock the config property to return a proper config object
823
+ mock_config = Mock ()
824
+ mock_config .netapp_nic_slot_prefix = "e4"
825
+ mock_netapp_manager_instance .config = mock_config
782
826
mock_netapp_manager_instance .create_routes_for_project .return_value = []
783
827
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
784
828
@@ -852,6 +896,10 @@ def test_end_to_end_netapp_interface_creation_with_realistic_data(
852
896
853
897
# Mock NetAppManager
854
898
mock_netapp_manager_instance = Mock ()
899
+ # Mock the config property to return a proper config object
900
+ mock_config = Mock ()
901
+ mock_config .netapp_nic_slot_prefix = "e4"
902
+ mock_netapp_manager_instance .config = mock_config
855
903
mock_netapp_manager_instance .create_routes_for_project .return_value = []
856
904
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
857
905
@@ -951,6 +999,10 @@ def test_complete_route_creation_workflow_with_complex_sample(
951
999
952
1000
# Mock NetAppManager with route creation results
953
1001
mock_netapp_manager_instance = Mock ()
1002
+ # Mock the config property to return a proper config object
1003
+ mock_config = Mock ()
1004
+ mock_config .netapp_nic_slot_prefix = "e4"
1005
+ mock_netapp_manager_instance .config = mock_config
954
1006
expected_route_results = [
955
1007
RouteResult (
956
1008
uuid = "route-uuid-1" ,
@@ -1051,6 +1103,10 @@ def test_route_creation_with_mocked_netapp_sdk(
1051
1103
1052
1104
# Mock NetAppManager with route creation results
1053
1105
mock_netapp_manager_instance = Mock ()
1106
+ # Mock the config property to return a proper config object
1107
+ mock_config = Mock ()
1108
+ mock_config .netapp_nic_slot_prefix = "e4"
1109
+ mock_netapp_manager_instance .config = mock_config
1054
1110
expected_route_results = [
1055
1111
RouteResult (
1056
1112
uuid = "route-uuid-1" ,
@@ -1128,6 +1184,10 @@ def test_route_creation_error_propagation(
1128
1184
1129
1185
# Mock NetAppManager with route creation failure
1130
1186
mock_netapp_manager_instance = Mock ()
1187
+ # Mock the config property to return a proper config object
1188
+ mock_config = Mock ()
1189
+ mock_config .netapp_nic_slot_prefix = "e4"
1190
+ mock_netapp_manager_instance .config = mock_config
1131
1191
mock_netapp_manager_instance .create_routes_for_project .side_effect = Exception (
1132
1192
"Route creation failed: SVM not found"
1133
1193
)
@@ -1188,6 +1248,10 @@ def test_netapp_rest_error_handling_during_route_creation(
1188
1248
1189
1249
# Mock NetAppManager with NetworkOperationError (which wraps NetAppRestError)
1190
1250
mock_netapp_manager_instance = Mock ()
1251
+ # Mock the config property to return a proper config object
1252
+ mock_config = Mock ()
1253
+ mock_config .netapp_nic_slot_prefix = "e4"
1254
+ mock_netapp_manager_instance .config = mock_config
1191
1255
mock_netapp_manager_instance .create_routes_for_project .side_effect = (
1192
1256
NetworkOperationError (
1193
1257
"Route creation failed: NetApp REST API error" ,
@@ -1256,6 +1320,10 @@ def test_script_termination_on_route_creation_failure(
1256
1320
1257
1321
# Mock NetAppManager with route creation failure that should terminate script
1258
1322
mock_netapp_manager_instance = Mock ()
1323
+ # Mock the config property to return a proper config object
1324
+ mock_config = Mock ()
1325
+ mock_config .netapp_nic_slot_prefix = "e4"
1326
+ mock_netapp_manager_instance .config = mock_config
1259
1327
mock_netapp_manager_instance .create_routes_for_project .side_effect = Exception (
1260
1328
"Critical route creation failure: Unable to connect to NetApp system"
1261
1329
)
@@ -1331,6 +1399,10 @@ def test_error_logging_and_context_for_route_failures(
1331
1399
},
1332
1400
)
1333
1401
mock_netapp_manager_instance = Mock ()
1402
+ # Mock the config property to return a proper config object
1403
+ mock_config = Mock ()
1404
+ mock_config .netapp_nic_slot_prefix = "e4"
1405
+ mock_netapp_manager_instance .config = mock_config
1334
1406
mock_netapp_manager_instance .create_routes_for_project .side_effect = (
1335
1407
detailed_error
1336
1408
)
@@ -1406,6 +1478,10 @@ def test_invalid_svm_name_handling_during_route_creation(
1406
1478
},
1407
1479
)
1408
1480
mock_netapp_manager_instance = Mock ()
1481
+ # Mock the config property to return a proper config object
1482
+ mock_config = Mock ()
1483
+ mock_config .netapp_nic_slot_prefix = "e4"
1484
+ mock_netapp_manager_instance .config = mock_config
1409
1485
mock_netapp_manager_instance .create_routes_for_project .side_effect = svm_error
1410
1486
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
1411
1487
@@ -1466,6 +1542,10 @@ def test_route_creation_logging_verification(
1466
1542
1467
1543
# Mock NetAppManager with successful route creation
1468
1544
mock_netapp_manager_instance = Mock ()
1545
+ # Mock the config property to return a proper config object
1546
+ mock_config = Mock ()
1547
+ mock_config .netapp_nic_slot_prefix = "e4"
1548
+ mock_netapp_manager_instance .config = mock_config
1469
1549
expected_route_results = [
1470
1550
RouteResult (
1471
1551
uuid = "route-uuid-1" ,
@@ -1545,6 +1625,10 @@ def test_route_creation_with_single_interface_sample(
1545
1625
1546
1626
# Mock NetAppManager with route creation results
1547
1627
mock_netapp_manager_instance = Mock ()
1628
+ # Mock the config property to return a proper config object
1629
+ mock_config = Mock ()
1630
+ mock_config .netapp_nic_slot_prefix = "e4"
1631
+ mock_netapp_manager_instance .config = mock_config
1548
1632
expected_route_results = [
1549
1633
RouteResult (
1550
1634
uuid = "route-uuid-1" ,
@@ -1620,6 +1704,10 @@ def test_route_creation_with_empty_results_skips_route_creation(
1620
1704
1621
1705
# Mock NetAppManager
1622
1706
mock_netapp_manager_instance = Mock ()
1707
+ # Mock the config property to return a proper config object
1708
+ mock_config = Mock ()
1709
+ mock_config .netapp_nic_slot_prefix = "e4"
1710
+ mock_netapp_manager_instance .config = mock_config
1623
1711
mock_netapp_manager_class .return_value = mock_netapp_manager_instance
1624
1712
1625
1713
# Mock sys.argv for argument parsing
0 commit comments