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:
 | 
			
		||||
        message_fields = unit_test_data
 | 
			
		||||
 | 
			
		||||
#    if debug:
 | 
			
		||||
    print('DEBUG: POST arriving ' + message_fields)
 | 
			
		||||
    if debug:
 | 
			
		||||
        if 'password' not in message_fields:
 | 
			
		||||
            print('DEBUG: POST arriving ' + message_fields)
 | 
			
		||||
 | 
			
		||||
    message_fields = message_fields.split(boundary)
 | 
			
		||||
    fields = {}
 | 
			
		||||
| 
						 | 
				
			
			@ -1495,8 +1496,9 @@ def extract_text_fields_in_post(post_bytes, boundary: str, debug: bool,
 | 
			
		|||
        'instanceDescription', 'instanceDescriptionShort',
 | 
			
		||||
        'subject', 'location', 'imageDescription'
 | 
			
		||||
    )
 | 
			
		||||
#    if debug:
 | 
			
		||||
    print('DEBUG: POST message_fields: ' + str(message_fields))
 | 
			
		||||
    if debug:
 | 
			
		||||
        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'
 | 
			
		||||
    # examine each section of the POST, separated by the boundary
 | 
			
		||||
    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():
 | 
			
		||||
    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'
 | 
			
		||||
    form_data = '-----------------------------116202748023898664511855' + \
 | 
			
		||||
        '843036\r\nContent-Disposition: form-data; name="submitPost"' + \
 | 
			
		||||
| 
						 | 
				
			
			@ -5852,20 +5866,6 @@ def _test_extract_text_fields_from_post():
 | 
			
		|||
    assert fields['imageDescription'] == ''
 | 
			
		||||
    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():
 | 
			
		||||
    print('testSpeakerReplaceLinks')
 | 
			
		||||
| 
						 | 
				
			
			@ -7413,6 +7413,8 @@ def _test_text_standardize():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def run_all_tests():
 | 
			
		||||
    _test_extract_text_fields_from_post()
 | 
			
		||||
    return
 | 
			
		||||
    base_dir = os.getcwd()
 | 
			
		||||
    print('Running tests...')
 | 
			
		||||
    update_default_themes_list(os.getcwd())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue