mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Adda test case for #1069.
This commit is contained in:
parent
117ef10176
commit
da37bcfebe
@ -1,7 +1,5 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import t
|
|
||||||
|
|
||||||
from gunicorn.config import Config
|
from gunicorn.config import Config
|
||||||
from gunicorn.glogging import Logger
|
from gunicorn.glogging import Logger
|
||||||
|
|
||||||
@ -24,3 +22,19 @@ def test_atoms_defaults():
|
|||||||
assert atoms['r'] == 'GET http://my.uri HTTP/1.1'
|
assert atoms['r'] == 'GET http://my.uri HTTP/1.1'
|
||||||
assert atoms['{accept}i'] == 'application/json'
|
assert atoms['{accept}i'] == 'application/json'
|
||||||
assert atoms['{content-type}o'] == 'application/json'
|
assert atoms['{content-type}o'] == 'application/json'
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_username_from_basic_auth_header():
|
||||||
|
request = SimpleNamespace(headers=())
|
||||||
|
response = SimpleNamespace(
|
||||||
|
status='200', response_length=1024, sent=1024,
|
||||||
|
headers=(('Content-Type', 'text/plain'),),
|
||||||
|
)
|
||||||
|
environ = {
|
||||||
|
'REQUEST_METHOD': 'GET', 'RAW_URI': 'http://my.uri',
|
||||||
|
'SERVER_PROTOCOL': 'HTTP/1.1',
|
||||||
|
'HTTP_AUTHORIZATION': 'Basic YnJrMHY6',
|
||||||
|
}
|
||||||
|
logger = Logger(Config())
|
||||||
|
atoms = logger.atoms(response, request, environ, datetime.timedelta(seconds=1))
|
||||||
|
assert atoms['u'] == 'brk0v'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user