Update pastebin URL from bpaste to bpa.st (#9131)
This commit is contained in:
parent
e077f1cbd5
commit
e84ba80301
|
@ -0,0 +1 @@
|
|||
Fixed the URL used by ``--pastebin`` to use `bpa.st <http://bpa.st>`__.
|
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue