@@ -5013,17 +5013,15 @@ def test_grants_create_model_kind(
50135013
50145014
50155015@pytest .mark .parametrize (
5016- "target_layer,apply_on_create,apply_on_promote " ,
5016+ "target_layer" ,
50175017 [
5018- ( GrantsTargetLayer .PHYSICAL , True , False ) ,
5019- ( GrantsTargetLayer .VIRTUAL , False , True ) ,
5020- ( GrantsTargetLayer .ALL , True , True ) ,
5018+ GrantsTargetLayer .PHYSICAL ,
5019+ GrantsTargetLayer .VIRTUAL ,
5020+ GrantsTargetLayer .ALL ,
50215021 ],
50225022)
50235023def test_grants_target_layer (
50245024 target_layer : GrantsTargetLayer ,
5025- apply_on_create : bool ,
5026- apply_on_promote : bool ,
50275025 adapter_mock : Mock ,
50285026 mocker : MockerFixture ,
50295027 make_snapshot : t .Callable [..., Snapshot ],
@@ -5045,19 +5043,17 @@ def test_grants_target_layer(
50455043 snapshot .categorize_as (SnapshotChangeCategory .BREAKING )
50465044
50475045 evaluator .create ([snapshot ], {})
5048- if apply_on_create :
5049- sync_grants_mock .assert_called_once ()
5050- assert sync_grants_mock .call_args [0 ][1 ] == grants
5046+ if target_layer == GrantsTargetLayer .VIRTUAL :
5047+ assert sync_grants_mock .call_count == 0
50515048 else :
5052- sync_grants_mock .assert_not_called ()
5053-
5049+ assert sync_grants_mock .call_count == 1
5050+ assert sync_grants_mock . call_args [ 0 ][ 1 ] == grants
50545051 sync_grants_mock .reset_mock ()
50555052 evaluator .promote ([snapshot ], EnvironmentNamingInfo (name = "prod" ))
5056- if apply_on_promote :
5057- sync_grants_mock .assert_called_once ()
5058- assert sync_grants_mock .call_args [0 ][1 ] == grants
5053+ if target_layer == GrantsTargetLayer .ALL :
5054+ assert sync_grants_mock .call_count == 2
50595055 else :
5060- sync_grants_mock .assert_not_called ()
5056+ assert sync_grants_mock .call_count == 1
50615057
50625058
50635059def test_grants_update (
0 commit comments