Merge pull request #5808 from goerz/pastebin

Fix "lexer" being used when uploading to bpaste.net
This commit is contained in:
Bruno Oliveira 2019-08-31 16:11:39 -03:00 committed by GitHub
commit 1675048b35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -0,0 +1 @@
Fix "lexer" being used when uploading to bpaste.net from ``--pastebin`` to "text".

View File

@ -65,7 +65,7 @@ def create_new_paste(contents):
from urllib.request import urlopen
from urllib.parse import urlencode
params = {"code": contents, "lexer": "python3", "expiry": "1week"}
params = {"code": contents, "lexer": "text", "expiry": "1week"}
url = "https://bpaste.net"
try:
response = (

View File

@ -165,7 +165,7 @@ class TestPaste:
assert len(mocked_urlopen) == 1
url, data = mocked_urlopen[0]
assert type(data) is bytes
lexer = "python3"
lexer = "text"
assert url == "https://bpaste.net"
assert "lexer=%s" % lexer in data.decode()
assert "code=full-paste-contents" in data.decode()