コード例 #1
0
 def test_config_basic(self):
     c = ConfigDeserializer(
         core={"num_workers": 30},
         logging={"file": ""},
         user_defined={"my_opt": True},
     )
     assert c.dict() == {
         "inventory": {
             "plugin": "nornir.plugins.inventory.simple.SimpleInventory",
             "options": {},
             "transform_function": "",
             "transform_function_options": {},
         },
         "ssh": {
             "config_file": "~/.ssh/config"
         },
         "logging": {
             "enabled": None,
             "level": "INFO",
             "file": "",
             "format": DEFAULT_LOG_FORMAT,
             "to_console": False,
             "loggers": ["nornir"],
         },
         "jinja2": {
             "filters": ""
         },
         "core": {
             "num_workers": 30,
             "raise_on_error": False
         },
         "user_defined": {
             "my_opt": True
         },
     }
コード例 #2
0
 def test_config_defaults(self):
     c = ConfigDeserializer()
     assert c.dict() == {
         "inventory": {
             "plugin": "nornir.plugins.inventory.simple.SimpleInventory",
             "options": {},
             "transform_function": "",
         },
         "ssh": {
             "config_file": "~/.ssh/config"
         },
         "logging": {
             "level": "debug",
             "file": "nornir.log",
             "format": DEFAULT_LOG_FORMAT,
             "to_console": False,
             "loggers": ["nornir"],
         },
         "jinja2": {
             "filters": ""
         },
         "core": {
             "num_workers": 20,
             "raise_on_error": False
         },
         "user_defined": {},
     }