From 064127dc16412e7cc8df353f315c629dc32349aa Mon Sep 17 00:00:00 2001 From: "Maxime Alves LIRMM@home" Date: Fri, 3 Feb 2023 00:02:56 +0100 Subject: [PATCH] [fix] tests for running by implementing the dry-run option to the domain command --- halfapi/cli/domain.py | 6 +++++- tests/cli/test_cli_proj.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/halfapi/cli/domain.py b/halfapi/cli/domain.py index f338a17..942e1db 100644 --- a/halfapi/cli/domain.py +++ b/halfapi/cli/domain.py @@ -119,6 +119,7 @@ def list_api_routes(): # list_routes(domain, m_dom) +@click.option('--dry-run',default=False, is_flag=True) @click.option('--run',default=False, is_flag=True) @click.option('--read',default=False, is_flag=True) @click.option('--create',default=False, is_flag=True) @@ -127,7 +128,7 @@ def list_api_routes(): @click.argument('config_file', type=click.File(mode='rb'), required=False) @click.argument('domain',default=None, required=False) @cli.command() -def domain(domain, config_file, delete, update, create, read, run): #, domains, read, create, update, delete): +def domain(domain, config_file, delete, update, create, read, run, dry_run): #, domains, read, create, update, delete): """ The "halfapi domain" command @@ -177,6 +178,9 @@ def domain(domain, config_file, delete, update, create, read, run): #, domains, 'name': domain } + if dry_run: + CONFIG['dryrun'] = True + CONFIG['domain'][domain]['enabled'] = True port = CONFIG['domain'][domain].get('port', 3000) diff --git a/tests/cli/test_cli_proj.py b/tests/cli/test_cli_proj.py index 7331dde..86fc9f6 100644 --- a/tests/cli/test_cli_proj.py +++ b/tests/cli/test_cli_proj.py @@ -39,7 +39,7 @@ class TestCliProj(): }) ) - r = project_runner(f'domain dummy_domain {tmp_conf}') + r = project_runner(f'domain dummy_domain --dry-run {tmp_conf}') print(r.stdout) assert r.exit_code == 0