コード例 #1
0
    def setUp(self):
        self.config = get_config_for_testing(TMP_DIR)

        self.mongo_mgr = MongoMgr(self.config)

        self.frontend = WebFrontEnd(config=self.config)
        self.frontend.app.config['TESTING'] = True
        self.test_client = self.frontend.app.test_client()
コード例 #2
0
def main():
    args = setup_argparse()
    file_name = os.path.basename(args.config_file)

    config = load_config(file_name)
    frontend = WebFrontEnd(config)

    start_user_management(frontend.app)

    return 0
コード例 #3
0
    def setUp(self):
        self.frontend = WebFrontEnd(config=self.config)
        self.frontend.app.config['TESTING'] = not self.config.getboolean('ExpertSettings', 'authentication')
        self.test_client = self.frontend.app.test_client()

        self.test_fw_a = self.TestFW('418a54d78550e8584291c96e5d6168133621f352bfc1d43cf84e81187fef4962_787',
                                     'container/test.zip', 'test_fw_a')
        self.test_fw_b = self.TestFW('d38970f8c5153d1041810d0908292bc8df21e7fd88aab211a8fb96c54afe6b01_319',
                                     'container/test.7z', 'test_fw_b')
        self.test_fw_c = self.TestFW('5fadb36c49961981f8d87cc21fc6df73a1b90aa1857621f2405d317afb994b64_68415',
                                     'regression_one', 'test_fw_c')
コード例 #4
0
ファイル: manage_users.py プロジェクト: fkie-cad/FACT_core
def main():
    args = setup_argparse()

    file_name = Path(args.config_file).name
    config = load_config(file_name)
    frontend = WebFrontEnd(config)

    start_user_management(frontend.app, frontend.user_datastore,
                          frontend.user_db, PromptSession())

    return 0
コード例 #5
0
ファイル: base.py プロジェクト: xuacker/FACT_core
    def setUp(self):
        self.frontend = WebFrontEnd(config=self.config)
        self.frontend.app.config['TESTING'] = not self.config.getboolean(
            'ExpertSettings', 'authentication')
        self.test_client = self.frontend.app.test_client()

        self.test_fw_a = self.TestFW(
            '418a54d78550e8584291c96e5d6168133621f352bfc1d43cf84e81187fef4962_787',
            'container/test.zip', 'test_fw_a')
        self.test_fw_b = self.TestFW(
            'd38970f8c5153d1041810d0908292bc8df21e7fd88aab211a8fb96c54afe6b01_319',
            'container/test.7z', 'test_fw_b')
コード例 #6
0
ファイル: base.py プロジェクト: schneiderderek/FACT_core
    def setUp(self):
        self.mocked_interface = DatabaseMock()

        self.enter_patch = unittest.mock.patch(target='helperFunctions.web_interface.ConnectTo.__enter__', new=lambda _: self.mocked_interface)
        self.enter_patch.start()

        self.exit_patch = unittest.mock.patch(target='helperFunctions.web_interface.ConnectTo.__exit__', new=fake_exit)
        self.exit_patch.start()

        self.config = get_config_for_testing(TMP_DIR)
        self.frontend = WebFrontEnd(config=self.config)
        self.frontend.app.config['TESTING'] = True
        self.test_client = self.frontend.app.test_client()
コード例 #7
0
    def setUp(self):
        self._set_config()
        self.mongo_server = MongoMgr(config=self.config)
        self.frontend = WebFrontEnd(config=self.config)
        self.frontend.app.config['TESTING'] = True
        self.test_client = self.frontend.app.test_client()

        self.test_fw_a = self.TestFW(
            '418a54d78550e8584291c96e5d6168133621f352bfc1d43cf84e81187fef4962_787',
            'container/test.zip', 'test_fw_a')
        self.test_fw_b = self.TestFW(
            'd38970f8c5153d1041810d0908292bc8df21e7fd88aab211a8fb96c54afe6b01_319',
            'container/test.7z', 'test_fw_b')
コード例 #8
0
ファイル: base.py プロジェクト: fkie-cad/FACT_core
    def setUp(self):
        self.tmp_dir = TemporaryDirectory(prefix='fact_test_')
        self.config.set('data_storage', 'firmware_file_storage_directory',
                        self.tmp_dir.name)
        self.config.set('Logging', 'mongoDbLogFile',
                        str(Path(self.tmp_dir.name) / 'mongo.log'))
        self.frontend = WebFrontEnd(config=self.config)
        self.frontend.app.config['TESTING'] = not self.config.getboolean(
            'ExpertSettings', 'authentication')
        self.test_client = self.frontend.app.test_client()

        self.test_fw_a = self.TestFW(
            '418a54d78550e8584291c96e5d6168133621f352bfc1d43cf84e81187fef4962_787',
            'container/test.zip', 'test_fw_a')
        self.test_fw_b = self.TestFW(
            'd38970f8c5153d1041810d0908292bc8df21e7fd88aab211a8fb96c54afe6b01_319',
            'container/test.7z', 'test_fw_b')
        self.test_fw_c = self.TestFW(
            '5fadb36c49961981f8d87cc21fc6df73a1b90aa1857621f2405d317afb994b64_68415',
            'regression_one', 'test_fw_c')
コード例 #9
0
 def setUp(self):
     self.frontend = WebFrontEnd(config=self.config)
     self.frontend.app.config['TESTING'] = True
     self.test_client = self.frontend.app.test_client()
コード例 #10
0
    console_log.setFormatter(log_format)
    logger.addHandler(file_log)
    logger.addHandler(console_log)


def _load_config(args):
    config = configparser.ConfigParser()
    config.read(args.config_file)
    if args.log_file is not None:
        config['Logging']['logFile'] = args.log_file
    if args.log_level is not None:
        config['Logging']['logLevel'] = args.log_level
    return config


def shutdown(*_):
    web_interface.shutdown()


args_path = sys.argv[-1]
if os.path.isfile(args_path):
    with open(args_path, "br") as fp:
        args = pickle.loads(fp.read())
    config = _load_config(args)
    _setup_logging(config, args.debug)
    web_interface = WebFrontEnd(config=config)
else:
    web_interface = WebFrontEnd()

app = web_interface.app
コード例 #11
0
def test_app(test_config):
    frontend = WebFrontEnd(config=test_config)
    frontend.app.config['TESTING'] = True
    return frontend.app.test_client()
コード例 #12
0
ファイル: conftest.py プロジェクト: fkie-cad/FACT_core
def test_app(test_config):  # pylint: disable=redefined-outer-name
    frontend = WebFrontEnd(config=test_config)
    with frontend.app.test_client() as client:
        yield client
コード例 #13
0
ファイル: conftest.py プロジェクト: xuacker/FACT_core
def test_app(test_config):
    client = WebFrontEnd(config=test_config)
    return client.app.test_client()
コード例 #14
0
ファイル: conftest.py プロジェクト: TingHL/FACT3.0
def test_app(test_config):  # pylint: disable=redefined-outer-name
    client = WebFrontEnd(config=test_config)
    return client.app.test_client()
コード例 #15
0
    logger.addHandler(console_log)


def _load_config(args):
    config = configparser.ConfigParser()
    config.read(args.config_file)
    if args.log_file is not None:
        config['Logging']['logFile'] = args.log_file
    if args.log_level is not None:
        config['Logging']['logLevel'] = args.log_level
    return config


def shutdown(*_):
    web_interface.shutdown()


PROGRAM_VERSION = get_version_string_from_git(get_directory_for_filename(__file__))

args_path = sys.argv[-1]
if os.path.isfile(args_path):
    with open(args_path, "br") as fp:
        args = pickle.loads(fp.read())
    config = _load_config(args)
    _setup_logging(config, args.debug)
    web_interface = WebFrontEnd(config=config, program_version=PROGRAM_VERSION)
else:
    web_interface = WebFrontEnd(program_version=PROGRAM_VERSION)

app = web_interface.app