Skip to content

Commit f1d96d1

Browse files
committed
adjust test to fail according to prod observation
1 parent 638f2dc commit f1d96d1

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
2-
"Server": "GitHub.com",
3-
"Date": "Wed, 29 May 2024 12:07:38 GMT",
2+
"Date": "Mon, 11 Nov 2024 18:14:12 GMT",
43
"Content-Type": "application/json; charset=utf-8",
5-
"Cache-Control": "public, max-age=60, s-maxage=60",
6-
"Vary": "Accept, Accept-Encoding, Accept, X-Requested-With",
7-
"ETag": "W/\"7ba8c0b529b1303243a8c4636a95ce2e337591d152d69f8e90608c202a166483\"",
8-
"Last-Modified": "Wed, 10 Apr 2024 13:15:22 GMT",
4+
"Content-Length": "15241",
5+
"Cache-Control": "private, max-age=60, s-maxage=60",
6+
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With",
7+
"ETag": "\"9995f8b0b0fe850244173c40390fbe8cb00fe525d7e58954bd6dd4bbcb74785a\"",
8+
"github-authentication-token-expiration": "2024-12-11 19:13:49 +0100",
9+
"Location": "https://api.github.com/repos/OWNER/REPO/pulls/1",
910
"X-GitHub-Media-Type": "github.v3; format=json",
11+
"x-accepted-github-permissions": "pull_requests=write",
1012
"x-github-api-version-selected": "2022-11-28",
13+
"X-RateLimit-Limit": "5000",
14+
"X-RateLimit-Remaining": "4996",
15+
"X-RateLimit-Reset": "1731350576",
16+
"X-RateLimit-Used": "4",
17+
"X-RateLimit-Resource": "core",
1118
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
1219
"Access-Control-Allow-Origin": "*",
1320
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
1421
"X-Frame-Options": "deny",
1522
"X-Content-Type-Options": "nosniff",
16-
"X-XSS-Protection": "0",
23+
"X-XSS-Protection": 0,
1724
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
1825
"Content-Security-Policy": "default-src 'none'",
19-
"Content-Encoding": "gzip",
20-
"X-RateLimit-Limit": "60",
21-
"X-RateLimit-Remaining": "51",
22-
"X-RateLimit-Reset": "1716987025",
23-
"X-RateLimit-Resource": "core",
24-
"X-RateLimit-Used": "9",
25-
"Accept-Ranges": "bytes",
26-
"Content-Length": "4456",
27-
"X-GitHub-Request-Id": "F7B3:2D05B1:3948EFC:3998343:74382A8F"
26+
"Server": "github.com",
27+
"X-GitHub-Request-Id": "1B69:2B877D:23D540:24422C:67324973"
2828
}

tests/test_git_utils.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,8 @@ def github_response_get_repo() -> dict:
10161016

10171017

10181018
@pytest.fixture()
1019-
def github_response_headers() -> dict:
1020-
return _github_api_json_fixture("github_response_headers")
1019+
def create_pull_response_headers() -> dict:
1020+
return _github_api_json_fixture("create_pull_response_headers")
10211021

10221022

10231023
def test_github_backend_from_token():
@@ -1272,7 +1272,7 @@ def test_github_backend_get_api_requests_left_zero_valid_reset_time(caplog):
12721272
def test_github_backend_create_pull_request_mock(
12731273
request_mock: MagicMock,
12741274
github_response_get_repo: dict,
1275-
github_response_headers: dict,
1275+
create_pull_response_headers: dict,
12761276
github_response_get_pull: dict,
12771277
):
12781278
def request_side_effect(method, _url, **_kwargs):
@@ -1285,7 +1285,7 @@ def request_side_effect(method, _url, **_kwargs):
12851285
response.status_code = 201
12861286
# note that the "create pull" response body is identical to the "get pull" response body
12871287
response.json = lambda: github_response_get_pull
1288-
response.headers = CaseInsensitiveDict(github_response_headers)
1288+
response.headers = CaseInsensitiveDict(create_pull_response_headers)
12891289
return response
12901290
assert False, f"Unexpected method: {method}"
12911291

@@ -1337,6 +1337,12 @@ def request_side_effect(method, _url, **_kwargs):
13371337
2024, 5, 27, 13, 31, 50, tzinfo=datetime.timezone.utc
13381338
)
13391339

1340+
assert (
1341+
pr_data.e_tag
1342+
== '"9995f8b0b0fe850244173c40390fbe8cb00fe525d7e58954bd6dd4bbcb74785a"'
1343+
)
1344+
assert pr_data.last_modified is None
1345+
13401346

13411347
@mock.patch("requests.Session.request")
13421348
def test_github_backend_create_pull_request_duplicate(

0 commit comments

Comments
 (0)