def test__using_with_valid_zip_and_target_folder(self): test_zip = Files.current_folder() target_folder = '/tmp/unzip_test' with Zip_Folder(test_zip) as (zip_file): with Unzip_File(zip_file, target_folder, True) as temp_folder: assert Files.exists(temp_folder) is True assert Files.exists(temp_folder) is False
def web_root(self): if os.getenv('AWS_REGION') is not None: # if we are in AWS return Files.path_combine('.', './web_root') if 'test/browser' in Files.current_folder( ): # if we are in an unit test return Files.path_combine('.', '../../../../src/web_root') parent_folder = Files.folder_name(__file__) if 'pbx-gs-python-utils/src/browser' in parent_folder: return Files.path_combine(parent_folder, '../../../../src/web_root') return None
def test__using_with_valid_zip_no_target_folder(self): test_zip = Files.current_folder() with Zip_Folder(test_zip) as (zip_file): with Unzip_File(zip_file, None, True) as temp_folder: assert Files.exists(temp_folder) is True assert Files.exists(temp_folder) is False
def test_exists(self): assert Files.exists(Files.current_folder()) is True assert Files.exists('aaaa_bbb_ccc') is False assert Files.exists(None) is False
def test__using_with_params(self): target_folder = Files.current_folder() with Zip_Folder(target_folder) as (zip_file): assert Files.exists(zip_file) is True assert Files.exists(zip_file) is False
def test_screenshot_file_in_folder(self): web_root = Files.current_folder() tmp_img = '/tmp/test_screenshot_html.png' html_file = 'aaaa.html' self.render_page.screenshot_file_in_folder(web_root, html_file, tmp_img)
def test_screenshot_folder(self): web_root = Files.current_folder() tmp_img = '/tmp/test_screenshot_html.png' clip = {'x': 1, 'y': 1, 'width':280, 'height': 200} self.render_page.screenshot_folder(web_root, tmp_img,clip)
def test_render_folder(self): result = self.render_page.render_folder(Files.current_folder()) Dev.print(result.html())