예제 #1
0
 def setUpClass(cls):
     try:
         startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB})
         time.sleep(3)
     except Exception:
         cls.driver.quit()
         cls.p.kill()
    def setUpClass(cls):
        # start email server
        # generate_ssl_testing_files()
        cls.email_server = AIOSMTPServer(hostname='127.0.0.1',
                                         port=1027,
                                         only_ssl=True,
                                         certfile='files/server.crt',
                                         keyfile='files/server.key',
                                         timeout=10)
        cls.email_server.start()
        startup(
            cls,
            cls.py_version, {
                'config_calibre_dir': TEST_DB,
                'config_converterpath': helper_email_convert.calibre_path(),
                'config_ebookconverter': 'converter2',
                'config_log_level': cls.LOG_LEVEL
            },
            env={"APP_MODE": "test"})

        cls.edit_user('admin', {
            'email': '*****@*****.**',
            'kindle_mail': '*****@*****.**'
        })
        cls.setup_server(
            False, {
                'mail_server': '127.0.0.1',
                'mail_port': '1027',
                'mail_use_ssl': 'SSL/TLS',
                'mail_login': '******',
                'mail_password': '******',
                'mail_from': '*****@*****.**'
            })
    def setUpClass(cls):
        try:
            thumbnail_cache_path = os.path.join(CALIBRE_WEB_PATH, 'cps',
                                                'cache', 'thumbnails')
            shutil.rmtree(thumbnail_cache_path, ignore_errors=True)

            shutil.rmtree(TEST_DB + '_3', ignore_errors=True)
            startup(cls,
                    cls.py_version, {'config_calibre_dir': TEST_DB},
                    env={
                        "APP_MODE": "test",
                        "CACHE_DIR": TEST_DB + '_3'
                    })
            time.sleep(3)
            WebDriverWait(cls.driver, 5).until(
                EC.presence_of_element_located((By.ID, "flash_success")))
            # generate new id for database to make calibre-web aware of database change
            add_books(os.path.join(TEST_DB, "metadata.db"),
                      100,
                      cover=True,
                      set_id=True)  # 1520
        except Exception as e:
            print(e)
            cls.driver.quit()
            cls.p.terminate()
            cls.p.poll()
예제 #4
0
    def setUpClass(cls):
        try:
            startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB}, env={"APP_MODE": "test"})

        except Exception:
            cls.driver.quit()
            cls.p.kill()
    def setUpClass(cls):
        add_dependency(cls.dependency, cls.__name__)

        try:
            # remove client_secrets.file
            dst = os.path.join(CALIBRE_WEB_PATH, "client_secrets.json")
            if os.path.exists(dst):
                os.unlink(dst)

            # delete settings_yaml file
            set_yaml = os.path.join(CALIBRE_WEB_PATH, "settings.yaml")
            if os.path.exists(set_yaml):
                os.unlink(set_yaml)

            # delete gdrive file
            gdrive_db = os.path.join(CALIBRE_WEB_PATH, "gdrive.db")
            if os.path.exists(gdrive_db):
                os.unlink(gdrive_db)

            # delete gdrive authenticated file
            gdauth = os.path.join(CALIBRE_WEB_PATH, "gdrive_credentials")
            if os.path.exists(gdauth):
                os.unlink(gdauth)

            startup(cls,
                    cls.py_version, {},
                    only_startup=True,
                    env={"APP_MODE": "test"})
        except Exception as e:
            try:
                print(e)
                cls.driver.quit()
                cls.p.kill()
            except Exception:
                pass
 def setUpClass(cls):
     add_dependency(cls.dependency, cls.__name__)
     try:
         startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB}, env={"APP_MODE": "test"})
         time.sleep(3)
     except Exception:
         cls.driver.quit()
         cls.p.kill()
 def setUpClass(cls):
     try:
         startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB}, work_path=CALIBRE_WEB_PATH,
                 only_startup=True, only_metadata=True, env={"APP_MODE": "test"})
         cls.login("admin", "admin123")
     except Exception:
         cls.driver.quit()
         cls.p.kill()
예제 #8
0
 def setUpClass(cls):
     try:
         startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB, "config_uploading": 1}, env = {"APP_MODE": "test"})
         time.sleep(3)
         cls.mass_create_users(1)
     except Exception:
         cls.driver.quit()
         cls.p.kill()
 def setUpClass(cls):
     try:
         startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB, 'config_uploading': 1},
                 env = {"APP_MODE": "test"})
         time.sleep(3)
         WebDriverWait(cls.driver, 5).until(EC.presence_of_element_located((By.ID, "flash_success")))
     except Exception:
         cls.driver.quit()
         cls.p.kill()
 def setUpClass(cls):
     try:
         startup(cls,
                 cls.py_version, {'config_calibre_dir': TEST_DB},
                 env={"APP_MODE": "test"})
         time.sleep(3)
         cls.goto_page("nav_new")
     except Exception:
         cls.driver.quit()
         cls.p.kill()
예제 #11
0
    def setUpClass(cls):
        add_dependency(cls.dep_line, cls.__name__)

        try:
            startup(cls,
                    cls.py_version, {'config_calibre_dir': TEST_DB},
                    env={"APP_MODE": "test"})
        except Exception as e:
            print('setup failed')
            cls.driver.quit()
            cls.p.terminate()
예제 #12
0
    def setUpClass(cls):

        try:
            startup(cls,
                    cls.py_version, {'config_calibre_dir': TEST_DB},
                    env={"APP_MODE": "test"})
            cls.current_handle = cls.driver.current_window_handle

        except Exception:
            cls.driver.quit()
            cls.p.terminate()
            cls.p.poll()
예제 #13
0
    def setUpClass(cls):
        try:
            host = 'http://' + get_Host_IP() + ':8083'
            cls.proxy = Reverse_Proxy(sitename=host)
            cls.proxy.start()
            startup(cls, cls.py_version, {'config_calibre_dir':TEST_DB}, host=host, parameter=["-i", get_Host_IP()], env={"APP_MODE": "test"})

            time.sleep(3)
            cls.driver.get('http://127.0.0.1:8080/cw')
            cls.login('admin', 'admin123')
        except Exception:
            cls.driver.quit()
            cls.p.kill()
    def setUpClass(cls):
        add_dependency(cls.dependencys, cls.__name__)

        try:
            startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB}, env={"APP_MODE": "test"})
            time.sleep(3)
            cls.fill_thumbnail_config({'schedule_generate_book_covers': 1})
            time.sleep(3)
            cls.restart_calibre_web()
            time.sleep(3)
        except Exception:
            cls.driver.quit()
            cls.p.kill()
예제 #15
0
    def setUpClass(cls):
        add_dependency(cls.dependency, cls.__name__)
        prepare_gdrive()
        try:
            src = os.path.join(base_path, "files", "client_secrets.json")
            dst = os.path.join(CALIBRE_WEB_PATH, "client_secrets.json")
            os.chmod(src, 0o764)
            if os.path.exists(dst):
                os.unlink(dst)
            shutil.copy(src, dst)

            # delete settings_yaml file
            set_yaml = os.path.join(CALIBRE_WEB_PATH, "settings.yaml")
            if os.path.exists(set_yaml):
                os.unlink(set_yaml)

            # delete gdrive file
            gdrive_db = os.path.join(CALIBRE_WEB_PATH, "gdrive.db")
            if os.path.exists(gdrive_db):
                os.unlink(gdrive_db)

            # delete gdrive authenticated file
            src = os.path.join(base_path, 'files', "gdrive_credentials")
            dst = os.path.join(CALIBRE_WEB_PATH, "gdrive_credentials")
            os.chmod(src, 0o764)
            if os.path.exists(dst):
                os.unlink(dst)
            shutil.copy(src, dst)

            startup(cls,
                    cls.py_version, {
                        'config_calibre_dir': TEST_DB,
                        'config_converterpath': '',
                        'config_kepubifypath':
                        helper_email_convert.kepubify_path()
                    },
                    env={"APP_MODE": "test"})
            cls.fill_db_config({'config_use_google_drive': 1})
            time.sleep(2)

            cls.edit_user('admin', {
                'email': '*****@*****.**',
                'kindle_mail': '*****@*****.**'
            })
            time.sleep(2)
        except Exception:
            cls.driver.quit()
            cls.p.kill()
예제 #16
0
 def setUpClass(cls):
     try:
         os.remove(os.path.join(CALIBRE_WEB_PATH, 'calibre-web.log'))
         os.remove(os.path.join(CALIBRE_WEB_PATH, 'calibre-web.log.1'))
         os.remove(os.path.join(CALIBRE_WEB_PATH, 'calibre-web.log.2'))
     except Exception:
         pass
     startup(cls,
             cls.py_version, {
                 'config_calibre_dir': TEST_DB,
                 'config_log_level': 'DEBUG'
             },
             env={"APP_MODE": "test"})
     time.sleep(3)
     WebDriverWait(cls.driver, 5).until(
         EC.presence_of_element_located((By.ID, "flash_success")))
예제 #17
0
    def setUpClass(cls):
        add_dependency(cls.dependency, cls.__name__)

        try:
            startup(cls,
                    cls.py_version, {
                        'config_calibre_dir': TEST_DB,
                        'config_use_goodreads': 1
                    },
                    env={"APP_MODE": "test"})
            WebDriverWait(cls.driver, 5).until(
                EC.presence_of_element_located((By.ID, "flash_success")))
        except Exception as e:
            print(e)
            cls.driver.quit()
            cls.p.terminate()
            cls.p.poll()
예제 #18
0
    def setUpClass(cls):
        add_dependency(cls.dependency, cls.__name__)

        prepare_gdrive()
        try:
            src = os.path.join(base_path, "files", "client_secrets.json")
            dst = os.path.join(CALIBRE_WEB_PATH, "client_secrets.json")
            os.chmod(src, 0o764)
            if os.path.exists(dst):
                os.unlink(dst)
            shutil.copy(src, dst)

            # delete settings_yaml file
            set_yaml = os.path.join(CALIBRE_WEB_PATH, "settings.yaml")
            if os.path.exists(set_yaml):
                os.unlink(set_yaml)

            # delete gdrive file
            gdrive_db = os.path.join(CALIBRE_WEB_PATH, "gdrive.db")
            if os.path.exists(gdrive_db):
                os.unlink(gdrive_db)

            # delete gdrive authenticated file
            src = os.path.join(base_path, 'files', "gdrive_credentials")
            dst = os.path.join(CALIBRE_WEB_PATH, "gdrive_credentials")
            os.chmod(src, 0o764)
            if os.path.exists(dst):
                os.unlink(dst)
            shutil.copy(src, dst)

            startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB,
                                          # 'config_log_level': 'DEBUG',
                                          'config_kepubifypath': '',
                                          'config_converterpath': ''},
                    only_metadata=True, env={"APP_MODE": "test"})
            cls.fill_db_config({'config_use_google_drive': 1})
            time.sleep(2)
            cls.fill_db_config({'config_google_drive_folder': 'test'})
            time.sleep(2)
        except Exception as e:
            try:
                print(e)
                cls.driver.quit()
                cls.p.kill()
            except Exception:
                pass
예제 #19
0
 def setUpClass(cls):
     try:
         # Upload needed for generating csrf token for edit shelf
         startup(cls,
                 cls.py_version, {
                     'config_calibre_dir': TEST_DB,
                     'config_uploading': 1
                 },
                 env={"APP_MODE": "test"})
         cls.create_user(
             'shelf', {
                 'edit_shelf_role': 1,
                 "upload_role": 1,
                 'password': '******',
                 'email': '*****@*****.**'
             })
         cls.edit_user('admin', {'edit_shelf_role': 1, 'email': '*****@*****.**'})
     except Exception:
         cls.driver.quit()
         cls.p.terminate()
예제 #20
0
    def setUpClass(cls):
        cls.email_server = AIOSMTPServer(
            hostname='127.0.0.1',port=1025,
            only_ssl=False,
            timeout=10
        )
        cls.email_server.start()

        try:
            startup(cls, cls.py_version, {'config_calibre_dir':TEST_DB,
                                          'config_public_reg': 1}, env={"APP_MODE": "test"})
            WebDriverWait(cls.driver, 5).until(EC.presence_of_element_located((By.ID, "flash_success")))
            cls.edit_user('admin', {'email': '*****@*****.**','kindle_mail': '*****@*****.**'})
            cls.setup_server(False, {'mail_server':'127.0.0.1', 'mail_port':'1025',
                                'mail_use_ssl':'None','mail_login':'******','mail_password':'******',
                                'mail_from':'*****@*****.**'})

        except Exception as e:
            print(e)
            cls.driver.quit()
            cls.p.kill()
예제 #21
0
    def setUpClass(cls):
        try:
            startup(cls,
                    cls.py_version, {
                        'config_calibre_dir': TEST_DB,
                        'config_converterpath': '',
                        'config_kepubifypath':
                        helper_email_convert.kepubify_path()
                    },
                    env={"APP_MODE": "test"})

            cls.edit_user('admin', {
                'email': '*****@*****.**',
                'kindle_mail': '*****@*****.**'
            })
            time.sleep(2)
            WebDriverWait(cls.driver, 5).until(
                EC.presence_of_element_located((By.ID, "flash_success")))
        except Exception as e:
            print("Dead on Init - check Calibre-Web is starting")
            cls.driver.quit()
            cls.p.kill()
예제 #22
0
    def setUpClass(cls):
        add_dependency(cls.json_line, cls.__name__)

        try:
            host = 'http://' + get_Host_IP() + ':8083'
            startup(cls, cls.py_version, {'config_calibre_dir':TEST_DB, 'config_log_level': 'DEBUG', 'config_kobo_sync':1,
                                          'config_kepubifypath': "",
                                          'config_kobo_proxy':0}, host=host, env={"APP_MODE": "test"})
            time.sleep(3)
            WebDriverWait(cls.driver, 5).until(EC.presence_of_element_located((By.ID, "flash_success")))
            cls.goto_page('user_setup')
            cls.check_element_on_page((By.ID, "config_create_kobo_token")).click()
            link = cls.check_element_on_page((By.CLASS_NAME, "well"))
            cls.kobo_adress = host + '/kobo/' + re.findall(".*/kobo/(.*)", link.text)[0]
            cls.check_element_on_page((By.ID, "kobo_close")).click()
            cls.driver.get('http://127.0.0.1:8083')
            cls.login('admin', 'admin123')
            time.sleep(2)
        except Exception as e:
            print(e)
            cls.driver.quit()
            cls.p.terminate()
            cls.p.poll()
    def setUpClass(cls):
        # start email server
        cls.email_server = AIOSMTPServer(hostname='127.0.0.1',
                                         port=1026,
                                         only_ssl=False,
                                         startSSL=True,
                                         certfile='files/server.crt',
                                         keyfile='files/server.key',
                                         timeout=10)
        cls.email_server.start()
        try:
            startup(cls,
                    cls.py_version, {
                        'config_calibre_dir': TEST_DB,
                        'config_converterpath':
                        helper_email_convert.calibre_path(),
                        'config_ebookconverter': 'converter2'
                    },
                    env={"APP_MODE": "test"})

            cls.edit_user('admin', {
                'email': '*****@*****.**',
                'kindle_mail': '*****@*****.**'
            })
            cls.setup_server(
                True, {
                    'mail_server': '127.0.0.1',
                    'mail_port': '1026',
                    'mail_use_ssl': 'SSL/TLS',
                    'mail_login': '******',
                    'mail_password': '******',
                    'mail_from': '*****@*****.**'
                })
        except:
            cls.driver.quit()
            cls.p.kill()
예제 #24
0
    def setUpClass(cls):
        # start email server
        cls.email_server = AIOSMTPServer(
            hostname='127.0.0.1',
            port=1025,
            only_ssl=False,
            timeout=10
        )

        cls.email_server.start()

        try:
            startup(cls, cls.py_version, {'config_calibre_dir':TEST_DB,
                                          'config_kepubifypath':'',
                                          'config_converterpath':helper_email_convert.calibre_path()}, env={"APP_MODE": "test"})

            cls.edit_user('admin', {'email': '*****@*****.**', 'kindle_mail': '*****@*****.**'})
            cls.setup_server(True, {'mail_server':'127.0.0.1', 'mail_port':'1025',
                                    'mail_use_ssl':'None', 'mail_login':'******', 'mail_password':'******',
                                    'mail_from':'*****@*****.**'})
            time.sleep(2)
        except Exception:
            cls.driver.quit()
            cls.p.kill()
예제 #25
0
    def setUpClass(cls):

        try:
            cls.proxy = Proxy()
            cls.proxy.start()
            pem_file = os.path.join(os.path.expanduser('~'), '.mitmproxy',
                                    'mitmproxy-ca-cert.pem')
            my_env = os.environ.copy()
            my_env["http_proxy"] = 'http://localhost:8080'
            my_env["https_proxy"] = 'http://localhost:8080'
            my_env["REQUESTS_CA_BUNDLE"] = pem_file
            my_env["APP_MODE"] = "test"
            # my_env["LANG"] = 'de_DE.UTF-8'
            startup(cls,
                    cls.py_version, {
                        'config_calibre_dir': TEST_DB,
                        'config_uploading': 1
                    },
                    env=my_env,
                    parameter=["-l"])
            time.sleep(3)
        except Exception:
            cls.driver.quit()
            cls.p.kill()
    def setUpClass(cls):
        add_dependency(cls.dependency, cls.__name__)
        thumbnail_cache_path = os.path.join(CALIBRE_WEB_PATH, 'cps', 'cache', 'thumbnails')
        shutil.rmtree(thumbnail_cache_path, ignore_errors=True)

        prepare_gdrive()
        try:
            src = os.path.join(base_path, "files", "client_secrets.json")
            dst = os.path.join(CALIBRE_WEB_PATH, "client_secrets.json")
            os.chmod(src, 0o764)
            if os.path.exists(dst):
                os.unlink(dst)
            shutil.copy(src, dst)

            # delete settings_yaml file
            set_yaml = os.path.join(CALIBRE_WEB_PATH, "settings.yaml")
            if os.path.exists(set_yaml):
                os.unlink(set_yaml)

            # delete gdrive file
            gdrive_db = os.path.join(CALIBRE_WEB_PATH, "gdrive.db")
            if os.path.exists(gdrive_db):
                os.unlink(gdrive_db)

            # delete gdrive authenticated file
            src = os.path.join(base_path, 'files', "gdrive_credentials")
            dst = os.path.join(CALIBRE_WEB_PATH, "gdrive_credentials")
            os.chmod(src, 0o764)
            if os.path.exists(dst):
                os.unlink(dst)
            shutil.copy(src, dst)

            # start email server
            cls.email_server = AIOSMTPServer(
                hostname='127.0.0.1',
                port=1025,
                only_ssl=False,
                timeout=10
            )

            cls.email_server.start()

            startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB,
                                          'config_log_level': 'DEBUG',
                                          'config_kepubifypath': '',
                                          'config_converterpath': helper_email_convert.calibre_path()},
                    only_metadata=True, env={"APP_MODE": "test"})
            cls.fill_db_config({'config_use_google_drive': 1})
            time.sleep(2)
            cls.fill_db_config({'config_google_drive_folder': 'test'})
            time.sleep(2)
            cls.edit_user('admin', {'email': '*****@*****.**', 'kindle_mail': '*****@*****.**'})
            cls.setup_server(True, {'mail_server': '127.0.0.1', 'mail_port': '1025',
                                    'mail_use_ssl': 'None', 'mail_login': '******', 'mail_password': '******',
                                    'mail_from': '*****@*****.**'})
            time.sleep(2)
            cls.fill_thumbnail_config({'schedule_generate_book_covers': 1})
            cls.restart_calibre_web()
            time.sleep(180)
        except Exception as e:
            try:
                print(e)
                cls.driver.quit()
                cls.p.kill()
            except Exception:
                pass
예제 #27
0
 def setUpClass(cls):
     try:
         startup(cls, cls.py_version, {'config_calibre_dir': TEST_DB, 'config_anonbrowse': 1}, env={"APP_MODE": "test"})
     except Exception as e:
         print(e)