def test_valid_small_config_with_overrides(self):
        CONFIG = config_parser.load_config(
            "./test_config_data/config_small.conf",
            overrides=["production", "ubuntu"])

        # Check for type of CONFIG
        self.assertIsNotNone(CONFIG)
        self.assertIsInstance(CONFIG, dict)

        # Check for invalid settings
        self.assertIsNone(CONFIG.something)
        self.assertIsNone(CONFIG["something"])
        self.assertIsNone(CONFIG.http.something)

        # Check for some valid settings
        self.assertEqual(CONFIG.common.student_size_limit, 52428800)
        self.assertEqual(CONFIG.common["student_size_limit"], 52428800)
        self.assertListEqual(CONFIG.http.params, ["array", "of", "values"])
        self.assertEqual(CONFIG.ftp.name, "hello there, ftp uploading")
        self.assertDictEqual(
            CONFIG.ftp, {
                'path': '/etc/var/uploads',
                'enabled': False,
                'name': 'hello there, ftp uploading'
            })

        # Check for some settings with overrides
        self.assertEqual(CONFIG.ftp.path, "/etc/var/uploads")
        self.assertEqual(CONFIG.ftp["path"], "/etc/var/uploads")
예제 #2
0
def main():
    version, mods = load_mods()
    config = load_config()
    mod_objs = []

    for mod in mods:
        file_id = None
        if "=" in mod:
            mod, file_id = mod.split("=")
        obj, depends = download(version, mod)

        if file_id is not None:
            obj.file_id = file_id

        for item in [obj, *depends]:
            if item not in mod_objs and item is not None:
                mod_objs.append(item)

    __import__("pprint").pprint(mod_objs)

    with open("manifest.json", "w") as f:
        json.dump(
            {
                "minecraft": {
                    "version":
                    config["mc_version"],
                    "modLoaders": [{
                        "id": "forge-" + config["forge"],
                        "primary": True
                    }]
                },
                "manifestType": "minecraftModpack",
                "manifestVersion": 1,
                "name": config["pack"],
                "version": config["version"],
                "author": config["author"],
                "files": mod_objs,
                "overrides": "overrides"
            },
            f,
            cls=CustomJSONEncoder,
            indent=4)
예제 #3
0
def fuzz(args: argparse.Namespace):
    config = config_parser.load_config(args.config)

    log_level = "DEBUG" if args.verbose else "INFO"

    Thread(name="celery",
           daemon=True,
           target=run_celery,
           args=[
               "worker -l {} --concurrency={}".format(
                   log_level, multiprocessing.cpu_count())
           ]).start()

    Thread(name="fuzz", daemon=True, target=config["fuzz_func"]).start()

    host = "0.0.0.0"
    port = utils.find_free_port(5307, 7000)
    print("Open http://localhost:{} for the Dasboard.".format(port))
    # This never returns until we Strg+c. Perfect.
    webserver.listen(host, int(port), config)
    def test_valid_small_config_without_overrides(self):
        CONFIG = config_parser.load_config(
            "./test_config_data/config_small.conf")

        # Check for type of CONFIG
        self.assertIsNotNone(CONFIG)
        self.assertIsInstance(CONFIG, dict)

        # Check for invalid keys
        self.assertIsNone(CONFIG.something)
        self.assertIsNone(CONFIG.http.something)

        # Check for some valid settings
        self.assertEqual(CONFIG.common.student_size_limit, 52428800)
        self.assertListEqual(CONFIG.http.params, ["array", "of", "values"])
        self.assertEqual(CONFIG.ftp.name, "hello there, ftp uploading")
        self.assertDictEqual(
            CONFIG.ftp, {
                'path': '/tmp/',
                'enabled': False,
                'name': 'hello there, ftp uploading'
            })
예제 #5
0
    app.config["analyzer"] = FexmDataAnalyzer(configuration_dir, base_image)

    logger.info("Listening on {}:{}".format(host, port))
    app.run(host=host, port=int(port), debug=True, use_reloader=False)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Start the webserver')
    parser.add_argument("-c",
                        "--config",
                        help="The configuration file used for the fuzzer",
                        type=str,
                        required=True)
    parser.add_argument("-p",
                        "--port",
                        nargs="?",
                        default=5307,
                        type=int,
                        help="Port to listen on")
    parser.add_argument("-l",
                        "--host",
                        nargs="?",
                        default="0.0.0.0",
                        type=str,
                        help="Listening host")
    args = parser.parse_args()

    config = config_parser.load_config(args.config)
    listen(args.host, args.port, config)
 def test_invalid_config_missing_file(self):
     with self.assertRaises(IOError):
         __ = config_parser.load_config(
             "./test_config_data/config_missing_file.conf")
 def test_invalid_config_with_garbage_line(self):
     with self.assertRaises(config_parser.InvalidLineError):
         __ = config_parser.load_config(
             "./test_config_data/config_garbage_line.conf")
 def test_invalid_config_with_duplicate_group(self):
     with self.assertRaises(config_parser.DuplicateGroupError):
         __ = config_parser.load_config(
             "./test_config_data/config_duplicate_group.conf")
 def test_invalid_config_with_missing_group(self):
     with self.assertRaises(config_parser.MissingGroupError):
         ___ = config_parser.load_config(
             "./test_config_data/config_missing_group.conf")