예제 #1
0
 def test_config_readonly_default(self):
     config = FileSource.config(
         parse_unknown("--source-file-filename", "feedface"))
     self.assertEqual(config.filename, "feedface")
     self.assertEqual(config.tag, "untagged")
     self.assertFalse(config.readwrite)
     self.assertFalse(config.allowempty)
예제 #2
0
 def test_args(self):
     self.assertEqual(
         FileSource.args({}),
         {
             "source": {
                 "arg": None,
                 "config": {
                     "file": {
                         "arg": None,
                         "config": {
                             "filename": {
                                 "arg": Arg(type=str),
                                 "config": {},
                             },
                             "readonly": {
                                 "arg":
                                 Arg(
                                     type=bool,
                                     action="store_true",
                                     default=False,
                                 ),
                                 "config": {},
                             },
                             "label": {
                                 "arg": Arg(type=str, default="unlabeled"),
                                 "config": {},
                             },
                         },
                     }
                 },
             }
         },
     )
예제 #3
0
 def test_config_readonly_set(self):
     config = FileSource.config(
         parse_unknown(
             "--source-file-filename",
             "feedface",
             "--source-file-label",
             "default-label",
             "--source-file-readonly",
         ))
     self.assertEqual(config.filename, "feedface")
     self.assertEqual(config.label, "default-label")
     self.assertTrue(config.readonly)
예제 #4
0
 def test_config_readonly_set(self):
     config = FileSource.config(
         parse_unknown(
             "--source-file-filename",
             "feedface",
             "--source-file-tag",
             "default-tag",
             "--source-file-readwrite",
             "--source-file-allowempty",
         ))
     self.assertEqual(config.filename, "feedface")
     self.assertEqual(config.tag, "default-tag")
     self.assertTrue(config.readwrite)
     self.assertTrue(config.allowempty)
예제 #5
0
 def test_args(self):
     self.assertEqual(
         FileSource.args({}),
         {
             "source": {
                 "plugin": None,
                 "config": {
                     "file": {
                         "plugin": None,
                         "config": {
                             "filename": {
                                 "plugin": Arg(type=str),
                                 "config": {},
                             },
                             "readwrite": {
                                 "plugin":
                                 Arg(
                                     type=bool,
                                     action="store_true",
                                     default=False,
                                 ),
                                 "config": {},
                             },
                             "allowempty": {
                                 "plugin":
                                 Arg(
                                     type=bool,
                                     action="store_true",
                                     default=False,
                                 ),
                                 "config": {},
                             },
                             "tag": {
                                 "plugin": Arg(type=str,
                                               default="untagged"),
                                 "config": {},
                             },
                         },
                     }
                 },
             }
         },
     )
예제 #6
0
 def test_config_readonly_default(self):
     config = FileSource.config(
         parse_unknown("--source-file-filename", "feedface"))
     self.assertEqual(config.filename, "feedface")
     self.assertEqual(config.label, "unlabeled")
     self.assertFalse(config.readonly)