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()
Example #3
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()
    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()
Example #5
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()
Example #6
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
Example #7
0
    def setUpClass(cls):
        add_dependency(cls.dependency, cls.__name__)

        prepare_gdrive()
        try:
            shutil.rmtree(os.path.join(CALIBRE_WEB_PATH, 'hü lo'),
                          ignore_errors=True)
            try:
                os.remove(os.path.join(CALIBRE_WEB_PATH, 'app.db'))
            except Exception:
                pass
            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)

            cls.driver = webdriver.Firefox()
            cls.driver.implicitly_wait(10)
            cls.driver.maximize_window()

        except Exception as e:
            try:
                print(e)
                cls.driver.quit()
            except Exception:
                pass
    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()
    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):
        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