Redo lynx unit test

main
Bob Mottram 2022-07-10 21:22:52 +01:00
parent 94ff176452
commit 0523568307
2 changed files with 5 additions and 6 deletions

View File

@ -4978,9 +4978,6 @@ class PubServer(BaseHTTPRequestHandler):
fields = \
extract_text_fields_in_post(post_bytes, boundary, debug)
print('hashtag category POST bytes: ' + str(post_bytes))
print('hashtag category POST fields: ' + str(fields))
if fields.get('hashtagCategory'):
category_str = fields['hashtagCategory'].lower()
if not is_blocked_hashtag(base_dir, category_str) and \

View File

@ -5855,12 +5855,14 @@ def _test_extract_text_fields_from_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\n' + \
'Content-Disposition: form-data; name="submitYes"\r\n' + \
'Content-Type: text/plain; charset=utf-8\r\n\r\nBUTTON\r\n--LYNX--\r\n'
'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'