mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-29 16:55:32 +00:00
Optional argument for boolean command-line options
This commit is contained in:
parent
c3d1d19471
commit
52db4fa463
2 changed files with 8 additions and 7 deletions
|
@ -187,7 +187,7 @@ class TestBaseServerRequests(BaseTest):
|
|||
self.thread.start()
|
||||
self.get("/", check=302)
|
||||
|
||||
def test_command_line_interface(self) -> None:
|
||||
def test_command_line_interface(self, with_bool_options=False) -> None:
|
||||
self.configuration.update({"headers": {"Test-Server": "test"}})
|
||||
config_args = []
|
||||
for section in self.configuration.sections():
|
||||
|
@ -197,7 +197,7 @@ class TestBaseServerRequests(BaseTest):
|
|||
if option.startswith("_"):
|
||||
continue
|
||||
long_name = "--%s-%s" % (section, option.replace("_", "-"))
|
||||
if config.DEFAULT_CONFIG_SCHEMA.get(
|
||||
if with_bool_options and config.DEFAULT_CONFIG_SCHEMA.get(
|
||||
section, {}).get(option, {}).get("type") == bool:
|
||||
if not cast(bool, self.configuration.get(section, option)):
|
||||
long_name = "--no%s" % long_name[1:]
|
||||
|
@ -224,6 +224,9 @@ class TestBaseServerRequests(BaseTest):
|
|||
if os.name == "posix":
|
||||
assert p.returncode == 0
|
||||
|
||||
def test_command_line_interface_with_bool_options(self) -> None:
|
||||
self.test_command_line_interface(with_bool_options=True)
|
||||
|
||||
def test_wsgi_server(self) -> None:
|
||||
config_path = os.path.join(self.colpath, "config")
|
||||
parser = RawConfigParser()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue