Update pastebin URL from bpaste to bpa.st (#9131)

This commit is contained in:
Jeff Rasley 2021-10-06 04:12:48 -07:00 committed by GitHub
parent e077f1cbd5
commit e84ba80301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -0,0 +1 @@
Fixed the URL used by ``--pastebin`` to use `bpa.st <http://bpa.st>`__.

View File

@ -77,7 +77,7 @@ def create_new_paste(contents: Union[str, bytes]) -> str:
from urllib.parse import urlencode
params = {"code": contents, "lexer": "text", "expiry": "1week"}
url = "https://bpaste.net"
url = "https://bpa.st"
try:
response: str = (
urlopen(url, data=urlencode(params).encode("ascii")).read().decode("utf-8")

View File

@ -161,12 +161,12 @@ class TestPaste:
def test_create_new_paste(self, pastebin, mocked_urlopen) -> None:
result = pastebin.create_new_paste(b"full-paste-contents")
assert result == "https://bpaste.net/show/3c0c6750bd"
assert result == "https://bpa.st/show/3c0c6750bd"
assert len(mocked_urlopen) == 1
url, data = mocked_urlopen[0]
assert type(data) is bytes
lexer = "text"
assert url == "https://bpaste.net"
assert url == "https://bpa.st"
assert "lexer=%s" % lexer in data.decode()
assert "code=full-paste-contents" in data.decode()
assert "expiry=1week" in data.decode()