@@ -21,7 +21,7 @@ def test_empty_upload_with_warnings(mocker):
2121 runner = CliRunner ()
2222 with runner .isolation () as outstreams :
2323 res = empty_upload_logic (
24- "commit_sha" , "owner/repo" , uuid .uuid4 (), "service" , None , False
24+ "commit_sha" , "owner/repo" , uuid .uuid4 (), "service" , None , False , False
2525 )
2626 out_bytes = parse_outstreams_into_log_lines (outstreams [0 ].getvalue ())
2727 assert out_bytes == [
@@ -50,7 +50,7 @@ def test_empty_upload_with_error(mocker):
5050 runner = CliRunner ()
5151 with runner .isolation () as outstreams :
5252 res = empty_upload_logic (
53- "commit_sha" , "owner/repo" , uuid .uuid4 (), "service" , None , False
53+ "commit_sha" , "owner/repo" , uuid .uuid4 (), "service" , None , False , False
5454 )
5555
5656 out_bytes = parse_outstreams_into_log_lines (outstreams [0 ].getvalue ())
@@ -77,7 +77,7 @@ def test_empty_upload_200(mocker):
7777 runner = CliRunner ()
7878 with runner .isolation () as outstreams :
7979 res = empty_upload_logic (
80- "commit_sha" , "owner/repo" , token , "service" , None , False
80+ "commit_sha" , "owner/repo" , token , "service" , None , False , False
8181 )
8282 out_bytes = parse_outstreams_into_log_lines (outstreams [0 ].getvalue ())
8383 assert out_bytes == [
@@ -96,10 +96,40 @@ def test_empty_upload_403(mocker):
9696 return_value = mocker .MagicMock (status_code = 403 , text = "Permission denied" ),
9797 )
9898 token = uuid .uuid4 ()
99- res = empty_upload_logic ("commit_sha" , "owner/repo" , token , "service" , None , False )
99+ res = empty_upload_logic (
100+ "commit_sha" , "owner/repo" , token , "service" , None , False , False
101+ )
100102 assert res .error == RequestError (
101103 code = "HTTP Error 403" ,
102104 description = "Permission denied" ,
103105 params = {},
104106 )
105107 mocked_response .assert_called_once ()
108+
109+
110+ def test_empty_upload_force (mocker ):
111+ res = {
112+ "result" : "Force option was enabled. Triggering passing notifications." ,
113+ "non_ignored_files" : [],
114+ }
115+ mocked_response = mocker .patch (
116+ "codecov_cli.helpers.request.requests.post" ,
117+ return_value = RequestResult (
118+ status_code = 200 , error = None , warnings = [], text = json .dumps (res )
119+ ),
120+ )
121+ token = uuid .uuid4 ()
122+ runner = CliRunner ()
123+ with runner .isolation () as outstreams :
124+ res = empty_upload_logic (
125+ "commit_sha" , "owner/repo" , token , "service" , None , False , True
126+ )
127+ out_bytes = parse_outstreams_into_log_lines (outstreams [0 ].getvalue ())
128+ assert out_bytes == [
129+ ("info" , "Process Empty Upload complete" ),
130+ ("info" , "Force option was enabled. Triggering passing notifications." ),
131+ ("info" , "Non ignored files []" ),
132+ ]
133+ assert res .error is None
134+ assert res .warnings == []
135+ mocked_response .assert_called_once ()
0 commit comments