def test_args(self):
     self.assertDictEqual(
         MemoryRedundancyChecker.args({}),
         {
             "rchecker": {
                 "plugin": None,
                 "config": {
                     "memory": {
                         "plugin": None,
                         "config": {
                             "kvstore": {
                                 "plugin":
                                 Arg(
                                     type=load_kvstore_with_args,
                                     help="Key value store to use",
                                     default=MemoryKeyValueStore(),
                                 ),
                                 "config": {},
                             }
                         },
                     }
                 },
             }
         },
     )
Beispiel #2
0
 def test_args(self):
     self.assertEqual(
         MemoryRedundancyChecker.args({}),
         {
             "rchecker": {
                 "arg": None,
                 "config": {
                     "memory": {
                         "arg": None,
                         "config": {
                             "kvstore": {
                                 "arg":
                                 Arg(
                                     type=BaseKeyValueStore.load,
                                     default=MemoryKeyValueStore,
                                 ),
                                 "config": {
                                     "withargs": {
                                         "arg": None,
                                         "config": {
                                             "filename": {
                                                 "arg": Arg(type=str),
                                                 "config": {},
                                             }
                                         },
                                     }
                                 },
                             }
                         },
                     }
                 },
             }
         },
     )
 async def test_config_default_label(self):
     with patch.object(BaseKeyValueStore, "load", load_kvstore_with_args):
         was = MemoryRedundancyChecker.config(await parse_unknown(
             "--rchecker-memory-kvstore",
             "withargs",
             "--rchecker-memory-kvstore-withargs-filename",
             "somefile",
         ))
         self.assertEqual(type(was), MemoryRedundancyCheckerConfig)
         self.assertEqual(type(was.kvstore), KeyValueStoreWithArguments)
         self.assertEqual(type(was.kvstore.config),
                          KeyValueStoreWithArgumentsConfig)
         self.assertEqual(was.kvstore.config.filename, "somefile")
Beispiel #4
0
 def test_config_default_label(self):
     was = MemoryRedundancyChecker.config(
         parse_unknown(
             "--rchecker-memory-kvstore",
             "withargs",
             "--rchecker-memory-kvstore-withargs-filename",
             "somefile",
         ))
     self.assertEqual(type(was), BaseRedundancyCheckerConfig)
     self.assertEqual(type(was.key_value_store), KeyValueStoreWithArguments)
     self.assertEqual(type(was.key_value_store.config),
                      KeyValueStoreWithArgumentsConfig)
     self.assertEqual(was.key_value_store.config.filename, "somefile")