mirror of https://gitlab.com/bashrc2/epicyon
Exclude password from debug
parent
e963b32353
commit
ccac5448e6
10
content.py
10
content.py
|
@ -1485,8 +1485,9 @@ def extract_text_fields_in_post(post_bytes, boundary: str, debug: bool,
|
||||||
else:
|
else:
|
||||||
message_fields = unit_test_data
|
message_fields = unit_test_data
|
||||||
|
|
||||||
# if debug:
|
if debug:
|
||||||
print('DEBUG: POST arriving ' + message_fields)
|
if 'password' not in message_fields:
|
||||||
|
print('DEBUG: POST arriving ' + message_fields)
|
||||||
|
|
||||||
message_fields = message_fields.split(boundary)
|
message_fields = message_fields.split(boundary)
|
||||||
fields = {}
|
fields = {}
|
||||||
|
@ -1495,8 +1496,9 @@ def extract_text_fields_in_post(post_bytes, boundary: str, debug: bool,
|
||||||
'instanceDescription', 'instanceDescriptionShort',
|
'instanceDescription', 'instanceDescriptionShort',
|
||||||
'subject', 'location', 'imageDescription'
|
'subject', 'location', 'imageDescription'
|
||||||
)
|
)
|
||||||
# if debug:
|
if debug:
|
||||||
print('DEBUG: POST message_fields: ' + str(message_fields))
|
if 'password' not in message_fields:
|
||||||
|
print('DEBUG: POST message_fields: ' + str(message_fields))
|
||||||
lynx_content_type = 'Content-Type: text/plain; charset=utf-8\r\n'
|
lynx_content_type = 'Content-Type: text/plain; charset=utf-8\r\n'
|
||||||
# examine each section of the POST, separated by the boundary
|
# examine each section of the POST, separated by the boundary
|
||||||
for fld in message_fields:
|
for fld in message_fields:
|
||||||
|
|
30
tests.py
30
tests.py
|
@ -5818,6 +5818,20 @@ def _test_markdown_to_html():
|
||||||
|
|
||||||
def _test_extract_text_fields_from_post():
|
def _test_extract_text_fields_from_post():
|
||||||
print('test_extract_text_fields_in_post')
|
print('test_extract_text_fields_in_post')
|
||||||
|
boundary = '--LYNX'
|
||||||
|
form_data = '--LYNX\r\nContent-Disposition: form-data; ' + \
|
||||||
|
'name="fieldName"\r\nContent-Type: text/plain; ' + \
|
||||||
|
'charset=utf-8\r\n\r\nThis is a lynx test\r\n' + \
|
||||||
|
'--LYNX\r\nContent-Disposition: ' + \
|
||||||
|
'form-data; name="submitYes"\r\nContent-Type: text/plain; ' + \
|
||||||
|
'charset=utf-8\r\n\r\nBUTTON\r\n--LYNX--\r\n'
|
||||||
|
debug = True
|
||||||
|
fields = extract_text_fields_in_post(None, boundary, debug, form_data)
|
||||||
|
print('fields: ' + str(fields))
|
||||||
|
assert fields
|
||||||
|
assert fields['fieldName'] == 'This is a lynx test'
|
||||||
|
assert fields['submitYes'] == 'BUTTON'
|
||||||
|
|
||||||
boundary = '-----------------------------116202748023898664511855843036'
|
boundary = '-----------------------------116202748023898664511855843036'
|
||||||
form_data = '-----------------------------116202748023898664511855' + \
|
form_data = '-----------------------------116202748023898664511855' + \
|
||||||
'843036\r\nContent-Disposition: form-data; name="submitPost"' + \
|
'843036\r\nContent-Disposition: form-data; name="submitPost"' + \
|
||||||
|
@ -5852,20 +5866,6 @@ def _test_extract_text_fields_from_post():
|
||||||
assert fields['imageDescription'] == ''
|
assert fields['imageDescription'] == ''
|
||||||
assert fields['message'] == 'This is a ; test'
|
assert fields['message'] == 'This is a ; test'
|
||||||
|
|
||||||
boundary = '--LYNX'
|
|
||||||
form_data = '--LYNX\r\nContent-Disposition: form-data; ' + \
|
|
||||||
'name="fieldName"\r\nContent-Type: text/plain; ' + \
|
|
||||||
'charset=utf-8\r\n\r\nThis is a lynx test\r\n' + \
|
|
||||||
'--LYNX\r\nContent-Disposition: ' + \
|
|
||||||
'form-data; name="submitYes"\r\nContent-Type: text/plain; ' + \
|
|
||||||
'charset=utf-8\r\n\r\nBUTTON\r\n--LYNX--\r\n'
|
|
||||||
debug = True
|
|
||||||
fields = extract_text_fields_in_post(None, boundary, debug, form_data)
|
|
||||||
print('fields: ' + str(fields))
|
|
||||||
assert fields
|
|
||||||
assert fields['fieldName'] == 'This is a lynx test'
|
|
||||||
assert fields['submitYes'] == 'BUTTON'
|
|
||||||
|
|
||||||
|
|
||||||
def _test_speaker_replace_link():
|
def _test_speaker_replace_link():
|
||||||
print('testSpeakerReplaceLinks')
|
print('testSpeakerReplaceLinks')
|
||||||
|
@ -7413,6 +7413,8 @@ def _test_text_standardize():
|
||||||
|
|
||||||
|
|
||||||
def run_all_tests():
|
def run_all_tests():
|
||||||
|
_test_extract_text_fields_from_post()
|
||||||
|
return
|
||||||
base_dir = os.getcwd()
|
base_dir = os.getcwd()
|
||||||
print('Running tests...')
|
print('Running tests...')
|
||||||
update_default_themes_list(os.getcwd())
|
update_default_themes_list(os.getcwd())
|
||||||
|
|
Loading…
Reference in New Issue