Esempio n. 1
0
    def setUp(self):

        config.data_dir = os.path.join(
            os.path.dirname(os.path.realpath(__file__)), "dbs")
        config.filename = os.path.join(config.data_dir, "temp_config")

        config.load_config()
Esempio n. 2
0
def run_headless(core, ci_mode):
    """ Run application in headless (no GUI) mode """

    import time

    from pynicotine.config import config
    from pynicotine.logfacility import log

    config.load_config()
    log.log_levels = set(["download", "upload"] +
                         config.sections["logging"]["debugmodes"])

    connect_ready = core.start()

    if not connect_ready and not ci_mode:
        return 1

    connect_success = core.connect()

    if not connect_success and not ci_mode:
        return 1

    while not core.shutdown:
        time.sleep(0.2)

    config.write_configuration()
    return 0
Esempio n. 3
0
    def setUp(self):

        config.data_dir = os.path.dirname(os.path.realpath(__file__))
        config.filename = os.path.join(config.data_dir, "temp_config")

        config.load_config()

        self.search = Search(None, config, deque(), None, None)
    def setUp(self):

        config.data_dir = os.path.dirname(os.path.realpath(__file__))
        config.filename = os.path.join(config.data_dir, "temp_config")

        config.load_config()

        self.transfers = Transfers(Mock(), config, deque(), {}, Mock())
        self.transfers.server_login()
    def setUp(self):

        config.data_dir = os.path.dirname(os.path.realpath(__file__))
        config.filename = os.path.join(config.data_dir, "temp_config")

        config.load_config()

        self.transfers = Transfers(Mock(), config, deque(), Mock())
        self.transfers.privileged_users = {"puser1", "puser2"}
    def setUp(self):

        config.data_dir = os.path.dirname(os.path.realpath(__file__))
        config.filename = os.path.join(config.data_dir, "temp_config")

        config.load_config()

        self.transfers = Transfers(MagicMock(), config, deque(), Mock())
        self.transfers.init_transfers()
        self.transfers.server_login()
        self.transfers.allow_saving_transfers = False
Esempio n. 7
0
def rescan_shares():

    from collections import deque

    from pynicotine.config import config
    from pynicotine.logfacility import log
    from pynicotine.shares import Shares

    config.load_config()

    shares = Shares(None, config, deque(), init_shares=False)
    error = shares.rescan_shares(use_thread=False)

    if error:
        log.add("--------------------------------------------------")
        log.add(
            _("Failed to scan shares. Please close other Nicotine+ instances and try again."
              ))
        return 1

    return 0