8000 test bpo in codeblocks · python/bedevere@c70d674 · GitHub
[go: up one dir, main page]

Skip to content

Commit c70d674

Browse files
committed
test bpo in codeblocks
1 parent 8a9ee48 commit c70d674

File tree

1 file changed

+49
-6
lines changed

1 file changed

+49
-6
lines changed

tests/test_bpo.py

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,8 @@ async def test_set_pull_request_body_already_hyperlinked_bpo(action):
384384
"statuses_url": "https://api.github.com/blah/blah/git-sha",
385385
"issue_url": "https://api.github.com/repos/blah/blah/issues/comments/123456",
386386
"body": ("bpo-123"
387-
"[bpo-123](https://bugs.python.org/issue123)"
388-
"<a href='https://bugs.python.org/issue123'>bpo-123</a>"
389-
)
387+
"[bpo-123](https://bugs.python.org/issue123)"
388+
"<a href='https://bugs.python.org/issue123'>bpo-123</a>")
390389
},
391390
"changes": {"stuff": "thingy"}
392391
}
@@ -407,9 +406,8 @@ async def test_set_comment_body_already_hyperlinked_bpo(action):
407406
"comment": {
408407
"url": "https://api.github.com/repos/blah/blah/issues/comments/123456",
409408
"body": ("bpo-123"
410-
"[bpo-123](https://bugs.python.org/issue123)"
411-
"<a href='https://bugs.python.org/issue123'>bpo-123</a>"
412-
)
409+
"[bpo-123](https://bugs.python.org/issue123)"
410+
"<a href='https://bugs.python.org/issue123'>bpo-123</a>")
413411
}
414412
}
415413

@@ -419,3 +417,48 @@ async def test_set_comment_body_already_hyperlinked_bpo(action):
419417
body_data = gh.patch_data
420418
assert body_data["body"].count("[bpo-123](https://bugs.python.org/issue123)") == 2
421419
assert "123456" in gh.patch_url
420+
421+
422+
@pytest.mark.asyncio
423+
@pytest.mark.parametrize("action", ["created", "edited"])
424+
async def test_untouched_bpo_text_within_codeblocks(action):
425+
data = {
426+
"action": action,
427+
"comment": {
428+
"url": "https://api.github.com/repos/blah/blah/issues/comments/123456",
429+
"body": ("bpo-123"
430+
"`bpo-123`"
431+
"[bpo-123](https://bugs.python.org/issue123)"
432+
"<a href='https://bugs.python.org/issue123'>bpo-123</a>")
433+
}
434+
}
435+
436+
event = sansio.Event(data, event="pull_request", delivery_id="123123")
437+
gh = FakeGH()
438+
await bpo.router.dispatch(event, gh)
439+
body_data = gh.patch_data
440+
print(body_data["body"])
441+
assert 1 == 2
442+
assert body_data["body"].count("[bpo-123](https://bugs.python.org/issue123)") == 3
443+
assert "123456" in gh.patch_url
444+
445+
446+
@pytest.mark.asyncio
447+
@pytest.mark.parametrize("action", ["created", "edited"])
448+
async def test_untouched_bpo_text_within_comment(action):
449+
data = {
450+
"action": action,
451+
"comment": {
452+
"url": "https://api.github.com/repos/blah/blah/issues/comments/123456",
453+
"body": ("bpo-123"
454+
"[bpo-123](https://bugs.python.org/issue123)"
455+
"<a href='https://bugs.python.org/issue123'>bpo-123</a>")
456+
}
457+
}
458+
459+
event = sansio.Event(data, event="pull_request", delivery_id="123123")
460+
gh = FakeGH()
461+
await bpo.router.dispatch(event, gh)
462+
body_data = gh.patch_data
463+
assert body_data["body"].count("[bpo-123](https://bugs.python.org/issue123)") == 2
464+
assert "123456" in gh.patch_url

0 commit comments

Comments
 (0)
0