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('.','./osbot_browser/web_root')
     if 'test/browser' in Files.current_folder():    # if we are in an unit test
         return  Files.path_combine('.','../../osbot_browser/web_root')
     parent_folder = Files.folder_name(__file__)
     if 'serverless-render/osbot_browser/browser' in parent_folder:
         return Files.path_combine(parent_folder,'../web_root')
     return None
Exemple #3
0
 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
Exemple #4
0
 def test_screenshot_file_in_folder(self):
     web_root = Files.current_folder()
     html_file = 'aaaa.html'
     self.render_page.screenshot_file_in_folder(web_root, html_file,
                                                self.tmp_img)
Exemple #5
0
 def test_screenshot_folder(self):
     web_root = Files.current_folder()
     clip = {'x': 1, 'y': 1, 'width': 280, 'height': 200}
     Files.delete(self.tmp_img)
     self.render_page.screenshot_folder(web_root, self.tmp_img, clip)
     assert Files.exists(self.tmp_img)
Exemple #6
0
 def test_render_folder(self):
     result = self.render_page.render_folder(Files.current_folder())
     assert "Directory listing for " in result.html()
Exemple #7
0
 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__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