@@ -6144,6 +6144,48 @@ def test_handle_upgrade_asm(self):
61446144 istio=self.models.IstioServiceMesh(revisions=["asm-1-17", "asm-1-18"]),
61456145 ))
61466146
6147+ def test_get_custom_ca_trust_certificates(self):
6148+ # Test with None - should return None
6149+ ctx_1 = AKSManagedClusterContext(
6150+ self.cmd,
6151+ AKSManagedClusterParamDict({"custom_ca_trust_certificates": None}),
6152+ self.models,
6153+ DecoratorMode.CREATE,
6154+ )
6155+ self.assertEqual(ctx_1.get_custom_ca_trust_certificates(), None)
6156+
6157+ # Test with empty string - should raise error
6158+ ctx_2 = AKSManagedClusterContext(
6159+ self.cmd,
6160+ AKSManagedClusterParamDict({"custom_ca_trust_certificates": ""}),
6161+ self.models,
6162+ DecoratorMode.CREATE,
6163+ )
6164+ with self.assertRaises(InvalidArgumentValueError):
6165+ ctx_2.get_custom_ca_trust_certificates()
6166+
6167+ # Test with valid file path - should return certificates
6168+ ctx_3 = AKSManagedClusterContext(
6169+ self.cmd,
6170+ AKSManagedClusterParamDict({"custom_ca_trust_certificates": get_test_data_file_path("certs.txt")}),
6171+ self.models,
6172+ DecoratorMode.CREATE,
6173+ )
6174+ certs = ctx_3.get_custom_ca_trust_certificates()
6175+ self.assertIsNotNone(certs)
6176+ self.assertEqual(len(certs), 2)
6177+
6178+ # Test with empty file - should return empty list (for removal)
6179+ ctx_4 = AKSManagedClusterContext(
6180+ self.cmd,
6181+ AKSManagedClusterParamDict({"custom_ca_trust_certificates": get_test_data_file_path("certs_empty.txt")}),
6182+ self.models,
6183+ DecoratorMode.CREATE,
6184+ )
6185+ certs_empty = ctx_4.get_custom_ca_trust_certificates()
6186+ self.assertIsNotNone(certs_empty)
6187+ self.assertEqual(certs_empty, [])
6188+
61476189
61486190class AKSManagedClusterCreateDecoratorTestCase(unittest.TestCase):
61496191 def setUp(self):
0 commit comments