Skip to content

Commit e250398

Browse files
Fix failing tests
1 parent 150bf1e commit e250398

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tests/python/test_infrastructures.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_infrastructure_creation_with_custom_policy_fragments(mock_utils, mock_p
116116
pfs = infra._define_policy_fragments()
117117

118118
# Should have base policy fragments + custom ones
119-
assert len(pfs) == 7 # 5 base + 2 custom
119+
assert len(pfs) == 8 # 6 base + 2 custom
120120
assert any(pf.name == 'Test-Fragment-1' for pf in pfs)
121121
assert any(pf.name == 'Test-Fragment-2' for pf in pfs)
122122
assert any(pf.name == 'AuthZ-Match-All' for pf in pfs)
@@ -225,8 +225,8 @@ def test_define_policy_fragments_with_none_input(mock_utils):
225225
pfs = infra._define_policy_fragments()
226226

227227
# Should only have base policy fragments
228-
assert len(pfs) == 5
229-
assert all(pf.name in ['AuthZ-Match-All', 'AuthZ-Match-Any', 'Http-Response-200', 'Product-Match-Any', 'Remove-Request-Headers'] for pf in pfs)
228+
assert len(pfs) == 6
229+
assert all(pf.name in ['Api-Id', 'AuthZ-Match-All', 'AuthZ-Match-Any', 'Http-Response-200', 'Product-Match-Any', 'Remove-Request-Headers'] for pf in pfs)
230230

231231
@pytest.mark.unit
232232
def test_define_policy_fragments_with_custom_input(mock_utils, mock_policy_fragments):
@@ -242,7 +242,7 @@ def test_define_policy_fragments_with_custom_input(mock_utils, mock_policy_fragm
242242
pfs = infra._define_policy_fragments()
243243

244244
# Should have base + custom policy fragments
245-
assert len(pfs) == 7 # 5 base + 2 custom
245+
assert len(pfs) == 8 # 6 base + 2 custom
246246
fragment_names = [pf.name for pf in infra.pfs]
247247
assert 'Test-Fragment-1' in fragment_names
248248
assert 'Test-Fragment-2' in fragment_names
@@ -319,7 +319,7 @@ def test_define_bicep_parameters(mock_utils):
319319

320320
assert 'policyFragments' in bicep_params
321321
assert isinstance(bicep_params['policyFragments']['value'], list)
322-
assert len(bicep_params['policyFragments']['value']) == 5 # base policy fragments
322+
assert len(bicep_params['policyFragments']['value']) == 6 # base policy fragments
323323

324324

325325
# ------------------------------
@@ -769,16 +769,16 @@ def test_infrastructure_end_to_end_simple(mock_utils):
769769

770770
# Verify all components are created correctly
771771
assert infra.infra == INFRASTRUCTURE.SIMPLE_APIM
772-
assert len(infra.base_pfs) == 5
773-
assert len(infra.pfs) == 5
772+
assert len(infra.base_pfs) == 6
773+
assert len(infra.pfs) == 6
774774
assert len(infra.base_apis) == 1
775775
assert len(infra.apis) == 1
776776

777777
# Verify bicep parameters
778778
bicep_params = infra._define_bicep_parameters()
779779
assert bicep_params['apimSku']['value'] == 'Developer'
780780
assert len(bicep_params['apis']['value']) == 1
781-
assert len(bicep_params['policyFragments']['value']) == 5
781+
assert len(bicep_params['policyFragments']['value']) == 6
782782

783783
@pytest.mark.unit
784784
def test_infrastructure_with_all_custom_components(mock_utils, mock_policy_fragments, mock_apis):
@@ -798,16 +798,16 @@ def test_infrastructure_with_all_custom_components(mock_utils, mock_policy_fragm
798798
infra._define_apis()
799799

800800
# Verify all components are combined correctly
801-
assert len(infra.base_pfs) == 5
802-
assert len(infra.pfs) == 7 # 5 base + 2 custom
801+
assert len(infra.base_pfs) == 6
802+
assert len(infra.pfs) == 8 # 6 base + 2 custom
803803
assert len(infra.base_apis) == 1
804804
assert len(infra.apis) == 3 # 1 base + 2 custom
805805

806806
# Verify bicep parameters include all components
807807
bicep_params = infra._define_bicep_parameters()
808808
assert bicep_params['apimSku']['value'] == 'Premium'
809809
assert len(bicep_params['apis']['value']) == 3
810-
assert len(bicep_params['policyFragments']['value']) == 7
810+
assert len(bicep_params['policyFragments']['value']) == 8
811811

812812

813813
# ------------------------------
@@ -856,7 +856,7 @@ def test_infrastructure_empty_custom_lists(mock_utils):
856856
infra._define_apis()
857857

858858
# Empty lists should behave the same as None
859-
assert len(infra.pfs) == 5 # Only base policy fragments
859+
assert len(infra.pfs) == 6 # Only base policy fragments
860860
assert len(infra.apis) == 1 # Only base APIs
861861

862862
@pytest.mark.unit
@@ -927,6 +927,7 @@ def test_policy_fragment_creation_robustness(mock_utils):
927927
'<policy3/>',
928928
'<policy4/>',
929929
'<policy5/>',
930+
'<policy6/>', # Added for the new Api-Id policy fragment
930931
'<hello-world-policy/>'
931932
]
932933

0 commit comments

Comments
 (0)