def test_get_pdf_htmls_content_without_encrypted(tmp_path): from ReadPDFFileV2 import get_pdf_htmls_content from ReadPDFFileV2 import get_images_paths_in_path try: get_pdf_htmls_content(f'{CWD}/encrypted.pdf', tmp_path) raise Exception("Incorrect password exception should've been thrown") except ShellException as e: assert 'Command Line Error: Incorrect password\nShell error code: 1' == str(e) html_text = get_pdf_htmls_content(f'{CWD}/hyperlinks.pdf', tmp_path) assert 'http://www.antennahouse.com/purchase.htm' in html_text assert len(get_images_paths_in_path(tmp_path)) != 0, 'Failed to get images from html'
def test_get_pdf_htmls_content_with_encrypted(mocker, tmp_path): mocker.patch.object(demisto, 'args', return_value={'userPassword': '******'}) from ReadPDFFileV2 import get_pdf_htmls_content from ReadPDFFileV2 import get_images_paths_in_path html_text = get_pdf_htmls_content(f'{CWD}/encrypted.pdf', tmp_path) expected = 'If you are end user who wishes to use XSL Formatter yourself, you may purchase ' \ 'from our Reseller or direct from Antenna<br/>House.<br/>' assert len(get_images_paths_in_path(tmp_path)) != 0, 'Failed to get images from html' assert expected in html_text