@@ -74,8 +74,8 @@ def checker(payload):
7474 "POST" , "/repos/py-cov-action/foobar/issues/2/comments" , json = checker
7575 )(status_code = 403 )
7676
77- git . register ( "git fetch origin main --depth=1000" )()
78- git .register ("git diff --unified=0 FETCH_HEAD...HEAD " )(stdout = DIFF_STDOUT )
77+ # What is the diff of the PR
78+ session .register ("GET" , "/repos/py-cov-action/foobar/pulls/2 " )(text = DIFF_STDOUT )
7979
8080 result = main .action (
8181 config = pull_request_config (
@@ -155,8 +155,8 @@ def checker(payload):
155155 "POST" , "/repos/py-cov-action/foobar/issues/2/comments" , json = checker
156156 )(status_code = 403 )
157157
158- git . register ( "git fetch origin foo --depth=1000" )( stdout = DIFF_STDOUT )
159- git .register ("git diff --unified=0 FETCH_HEAD...HEAD " )(stdout = DIFF_STDOUT )
158+ # What is the diff of the PR
159+ session .register ("GET" , "/repos/py-cov-action/foobar/pulls/2 " )(text = DIFF_STDOUT )
160160
161161 result = main .action (
162162 config = pull_request_config (
@@ -202,8 +202,8 @@ def test_action__pull_request__post_comment(
202202 # Are there already comments
203203 session .register ("GET" , "/repos/py-cov-action/foobar/issues/2/comments" )(json = [])
204204
205- git . register ( "git fetch origin main --depth=1000" )()
206- git .register ("git diff --unified=0 FETCH_HEAD...HEAD " )(stdout = DIFF_STDOUT )
205+ # What is the diff of the PR
206+ session .register ("GET" , "/repos/py-cov-action/foobar/pulls/2 " )(text = DIFF_STDOUT )
207207
208208 comment = None
209209
@@ -249,8 +249,11 @@ def test_action__push__non_default_branch(
249249 session .register ("GET" , "/repos/py-cov-action/foobar" )(
250250 json = {"default_branch" : "main" , "visibility" : "public" }
251251 )
252- git .register ("git fetch origin main --depth=1000" )(stdout = DIFF_STDOUT )
253- git .register ("git diff --unified=0 FETCH_HEAD...HEAD" )(stdout = DIFF_STDOUT )
252+
253+ # What is the diff of the `other` branch
254+ session .register ("GET" , "/repos/py-cov-action/foobar/compare/main...other" )(
255+ text = DIFF_STDOUT
256+ )
254257
255258 payload = json .dumps ({"coverage" : 30.00 })
256259 # There is an existing badge in this test, allowing to test the coverage evolution
@@ -338,8 +341,10 @@ def test_action__push__non_default_branch__no_pr(
338341 session .register ("GET" , "/repos/py-cov-action/foobar" )(
339342 json = {"default_branch" : "main" , "visibility" : "public" }
340343 )
341- git .register ("git fetch origin main --depth=1000" )(stdout = DIFF_STDOUT )
342- git .register ("git diff --unified=0 FETCH_HEAD...HEAD" )(stdout = DIFF_STDOUT )
344+ # What is the diff of the `other` branch
345+ session .register ("GET" , "/repos/py-cov-action/foobar/compare/main...other" )(
346+ text = DIFF_STDOUT
347+ )
343348
344349 payload = json .dumps ({"coverage" : 30.00 })
345350 # There is an existing badge in this test, allowing to test the coverage evolution
@@ -402,8 +407,8 @@ def test_action__pull_request__force_store_comment(
402407 "/repos/py-cov-action/foobar/contents/data.json" ,
403408 )(text = payload , headers = {"content-type" : "application/vnd.github.raw+json" })
404409
405- git . register ( "git fetch origin main --depth=1000" )()
406- git .register ("git diff --unified=0 FETCH_HEAD...HEAD " )(stdout = DIFF_STDOUT )
410+ # What is the diff of the PR
411+ session .register ("GET" , "/repos/py-cov-action/foobar/pulls/2 " )(text = DIFF_STDOUT )
407412
408413 result = main .action (
409414 config = pull_request_config (FORCE_WORKFLOW_RUN = True , GITHUB_OUTPUT = output_file ),
@@ -433,8 +438,8 @@ def test_action__pull_request__post_comment__no_marker(
433438 "/repos/py-cov-action/foobar/contents/data.json" ,
434439 )(status_code = 404 )
435440
436- git . register ( "git fetch origin main --depth=1000" )()
437- git .register ("git diff --unified=0 FETCH_HEAD...HEAD " )(stdout = DIFF_STDOUT )
441+ # What is the diff of the PR
442+ session .register ("GET" , "/repos/py-cov-action/foobar/pulls/2 " )(text = DIFF_STDOUT )
438443
439444 result = main .action (
440445 config = pull_request_config (COMMENT_TEMPLATE = """foo""" ),
@@ -458,8 +463,8 @@ def test_action__pull_request__annotations(
458463 "/repos/py-cov-action/foobar/contents/data.json" ,
459464 )(status_code = 404 )
460465
461- git . register ( "git fetch origin main --depth=1000" )()
462- git .register ("git diff --unified=0 FETCH_HEAD...HEAD " )(stdout = DIFF_STDOUT )
466+ # What is the diff of the PR
467+ session .register ("GET" , "/repos/py-cov-action/foobar/pulls/2 " )(text = DIFF_STDOUT )
463468
464469 # Who am I
465470 session .register ("GET" , "/user" )(json = {"login" : "foo" })
@@ -500,8 +505,8 @@ def test_action__pull_request__post_comment__template_error(
500505 "/repos/py-cov-action/foobar/contents/data.json" ,
501506 )(status_code = 404 )
502507
503- git . register ( "git fetch origin main --depth=1000" )()
504- git .register ("git diff --unified=0 FETCH_HEAD...HEAD " )(stdout = DIFF_STDOUT )
508+ # What is the diff of the PR
509+ session .register ("GET" , "/repos/py-cov-action/foobar/pulls/2 " )(text = DIFF_STDOUT )
505510
506511 result = main .action (
507512 config = pull_request_config (COMMENT_TEMPLATE = """{%""" ),
0 commit comments