@@ -73,8 +73,7 @@ def downloads_dir():
7373@pytest .fixture
7474def release_id_file ():
7575 f = Path (RELEASE_ID_FILE )
76- f .touch (0 ) # this will make the file unwritable
77- yield
76+ yield f
7877 f .unlink ()
7978
8079
@@ -133,9 +132,17 @@ def test_get_platform_display_name_invalid_platform():
133132 assert get_platform_display_name ("foo" ) == "FOO"
134133
135134
136- def test_write_to_release_id_file_broken_file_permissions (release_id_file ):
135+ def test_write_to_release_id_file (release_id_file ):
136+ write_to_release_id_file (GARDENLINUX_RELEASE )
137+ assert release_id_file .read_text () == GARDENLINUX_RELEASE
138+
139+
140+ def test_write_to_release_id_file_broken_file_permissions (release_id_file , caplog ):
141+ release_id_file .touch (0 ) # this will make the file unwritable
142+
137143 with pytest .raises (SystemExit ):
138144 write_to_release_id_file (GARDENLINUX_RELEASE )
145+ assert any ("Could not create" in record .message for record in caplog .records ), "Expected a failure log record"
139146
140147
141148def test_download_metadata_file (downloads_dir , release_s3_bucket ):
@@ -350,6 +357,19 @@ def test_upload_to_github_release_page(downloads_dir, caplog, github_token, arti
350357 "Expected an upload confirmation log entry"
351358
352359
360+ def test_upload_to_github_release_page_unreadable_artifact (downloads_dir , caplog , github_token , artifact_for_upload ):
361+ artifact_for_upload .chmod (0 )
362+
363+ upload_to_github_release_page (
364+ "gardenlinux" ,
365+ "gardenlinux" ,
366+ GARDENLINUX_RELEASE ,
367+ artifact_for_upload ,
368+ dry_run = False )
369+ assert any ("Error reading file" in record .message for record in caplog .records ), \
370+ "Expected an error message log entry"
371+
372+
353373def test_upload_to_github_release_page_failed (downloads_dir , caplog , github_token , artifact_for_upload ):
354374 with requests_mock .Mocker (real_http = True ) as m :
355375 m .post (
0 commit comments