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)
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": {}, }, }, } }, } }, )
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)
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)
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": {}, }, }, } }, } }, )
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)