@@ -5005,17 +5005,15 @@ def test_grants_create_model_kind(
50055005
50065006
50075007@pytest .mark .parametrize (
5008- "target_layer,apply_on_create,apply_on_promote " ,
5008+ "target_layer" ,
50095009 [
5010- ( GrantsTargetLayer .PHYSICAL , True , False ) ,
5011- ( GrantsTargetLayer .VIRTUAL , False , True ) ,
5012- ( GrantsTargetLayer .ALL , True , True ) ,
5010+ GrantsTargetLayer .PHYSICAL ,
5011+ GrantsTargetLayer .VIRTUAL ,
5012+ GrantsTargetLayer .ALL ,
50135013 ],
50145014)
50155015def test_grants_target_layer (
50165016 target_layer : GrantsTargetLayer ,
5017- apply_on_create : bool ,
5018- apply_on_promote : bool ,
50195017 adapter_mock : Mock ,
50205018 mocker : MockerFixture ,
50215019 make_snapshot : t .Callable [..., Snapshot ],
@@ -5037,19 +5035,17 @@ def test_grants_target_layer(
50375035 snapshot .categorize_as (SnapshotChangeCategory .BREAKING )
50385036
50395037 evaluator .create ([snapshot ], {})
5040- if apply_on_create :
5041- sync_grants_mock .assert_called_once ()
5042- assert sync_grants_mock .call_args [0 ][1 ] == grants
5038+ if target_layer == GrantsTargetLayer .VIRTUAL :
5039+ assert sync_grants_mock .call_count == 0
50435040 else :
5044- sync_grants_mock .assert_not_called ()
5045-
5041+ assert sync_grants_mock .call_count == 1
5042+ assert sync_grants_mock . call_args [ 0 ][ 1 ] == grants
50465043 sync_grants_mock .reset_mock ()
50475044 evaluator .promote ([snapshot ], EnvironmentNamingInfo (name = "prod" ))
5048- if apply_on_promote :
5049- sync_grants_mock .assert_called_once ()
5050- assert sync_grants_mock .call_args [0 ][1 ] == grants
5045+ if target_layer == GrantsTargetLayer .ALL :
5046+ assert sync_grants_mock .call_count == 2
50515047 else :
5052- sync_grants_mock .assert_not_called ()
5048+ assert sync_grants_mock .call_count == 1
50535049
50545050
50555051def test_grants_update (
0 commit comments