11from unittest .mock import MagicMock
22
33import pytest
4+ from shared .config import PATCH_CENTRIC_DEFAULT_CONFIG
45from shared .validation .types import BundleThreshold
56from shared .yaml import UserYaml
67
@@ -143,42 +144,51 @@ async def test_load_bundle_comparison_when_pull_is_none(
143144 "yaml_dict, percent_change, absolute_change, expected" ,
144145 [
145146 pytest .param (
146- {} ,
147+ PATCH_CENTRIC_DEFAULT_CONFIG ,
147148 1.0 ,
148149 10000 ,
149150 CommitStatusLevel .INFO ,
150151 id = "default_config_within_5%_change" ,
151152 ),
152153 pytest .param (
153- {} ,
154+ PATCH_CENTRIC_DEFAULT_CONFIG ,
154155 5.5 ,
155156 10000 ,
156157 CommitStatusLevel .WARNING ,
157158 id = "default_config_outside_5%_change" ,
158159 ),
159160 pytest .param (
160- {"bundle_analysis" : {"warning_threshold" : 10000 }},
161+ {
162+ ** PATCH_CENTRIC_DEFAULT_CONFIG ,
163+ "bundle_analysis" : {"warning_threshold" : 10000 },
164+ },
161165 1.0 ,
162166 10001 ,
163167 CommitStatusLevel .WARNING ,
164168 id = "informational_outside_range" ,
165169 ),
166170 pytest .param (
167- {"bundle_analysis" : {"warning_threshold" : 10000 }},
171+ {
172+ ** PATCH_CENTRIC_DEFAULT_CONFIG ,
173+ "bundle_analysis" : {"warning_threshold" : 10000 },
174+ },
168175 1.0 ,
169176 10000 ,
170177 CommitStatusLevel .INFO ,
171178 id = "informational_within_range" ,
172179 ),
173180 pytest .param (
174- {"bundle_analysis" : {"warning_threshold" : 10000 , "status" : True }},
181+ {
182+ ** PATCH_CENTRIC_DEFAULT_CONFIG ,
183+ "bundle_analysis" : {"warning_threshold" : 10000 , "status" : True },
184+ },
175185 1.0 ,
176186 10001 ,
177187 CommitStatusLevel .ERROR ,
178188 id = "fail_outside_range_absolute" ,
179189 ),
180190 pytest .param (
181- {"bundle_analysis" : {"status" : True }},
191+ {** PATCH_CENTRIC_DEFAULT_CONFIG , "bundle_analysis" : {"status" : True }},
182192 5.1 ,
183193 10000 ,
184194 CommitStatusLevel .ERROR ,
@@ -191,6 +201,7 @@ def test_load_commit_status_level(
191201 ):
192202 head_commit = CommitFactory ()
193203 dbsession .add (head_commit )
204+ yaml_dict .update (PATCH_CENTRIC_DEFAULT_CONFIG )
194205 user_yaml = UserYaml .from_dict (yaml_dict )
195206 builder = CommitStatusNotificationContextBuilder ().initialize (
196207 head_commit , user_yaml , GITHUB_APP_INSTALLATION_DEFAULT_NAME
@@ -220,7 +231,7 @@ def test_build_context(self, dbsession, mocker, mock_storage):
220231 enriched_pull = get_enriched_pull_setting_up_mocks (
221232 dbsession , mocker , (head_commit , base_commit )
222233 )
223- user_yaml = UserYaml .from_dict ({} )
234+ user_yaml = UserYaml .from_dict (PATCH_CENTRIC_DEFAULT_CONFIG )
224235 builder = CommitStatusNotificationContextBuilder ().initialize (
225236 head_commit , user_yaml , GITHUB_APP_INSTALLATION_DEFAULT_NAME
226237 )
@@ -252,7 +263,7 @@ def test_build_context(self, dbsession, mocker, mock_storage):
252263
253264 def test_initialize_from_context (self , dbsession , mocker ):
254265 head_commit , _ = get_commit_pair (dbsession )
255- user_yaml = UserYaml .from_dict ({} )
266+ user_yaml = UserYaml .from_dict (PATCH_CENTRIC_DEFAULT_CONFIG )
256267 builder = CommitStatusNotificationContextBuilder ().initialize (
257268 head_commit , user_yaml , GITHUB_APP_INSTALLATION_DEFAULT_NAME
258269 )
@@ -330,7 +341,15 @@ def test_evaluate_should_use_upgrade_message(
330341 return_value = auto_activate_succeeds ,
331342 )
332343 head_commit , _ = get_commit_pair (dbsession )
333- user_yaml = UserYaml .from_dict ({})
344+ user_yaml = UserYaml .from_dict (
345+ {
346+ "comment" : {
347+ "layout" : "reach,diff,flags,tree,reach" ,
348+ "behavior" : "default" ,
349+ "show_carryforward_flags" : False ,
350+ }
351+ }
352+ )
334353 builder = CommitStatusNotificationContextBuilder ().initialize (
335354 head_commit , user_yaml , GITHUB_APP_INSTALLATION_DEFAULT_NAME
336355 )
0 commit comments