From 0f5285693f88c3aa770119358b9488862c8e327d Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 17 Oct 2024 13:59:56 +0200 Subject: [PATCH 1/4] review feedback --- dds_cli/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dds_cli/__main__.py b/dds_cli/__main__.py index ebd533a2..7e12f1c9 100644 --- a/dds_cli/__main__.py +++ b/dds_cli/__main__.py @@ -2071,11 +2071,11 @@ def deactivate_motd(click_ctx, motd_id): @motd_group_command.command(name="send") @click.argument("motd_id", metavar="[MOTD_ID]", nargs=1, type=int, required=True) @click.option( - "--unit-personnel-only", + "--unit-only", is_flag=True, required=False, default=False, - help="Send MOTD to unit personnel only.", + help="Send MOTD to unit personnel and unit admins only.", ) @click.pass_obj def send_motd(click_ctx, motd_id, unit_personnel_only): From df1b48c28d3f73ca8cb463611487bec6f5d99243 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 17 Oct 2024 16:10:15 +0200 Subject: [PATCH 2/4] sprintlog --- SPRINTLOG.md | 4 ++++ dds_cli/__main__.py | 4 ++-- dds_cli/motd_manager.py | 4 ++-- tests/test_motd_manager.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index eb204097..62f0d4f7 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -384,3 +384,7 @@ _Empty sprint_ - New version and changelog([#714](https://github.com/ScilifelabDataCentre/dds_cli/pull/714)) - Added a new option to the motd send command to allow sending to unit personnel only ([#717](https://github.com/ScilifelabDataCentre/dds_cli/pull/717)) + +# 2024-10-07 - 2024-10-18 + +- Update MOTD command according to post merge review ([#720](https://github.com/ScilifelabDataCentre/dds_cli/pull/720)) \ No newline at end of file diff --git a/dds_cli/__main__.py b/dds_cli/__main__.py index 7e12f1c9..7d307e8e 100644 --- a/dds_cli/__main__.py +++ b/dds_cli/__main__.py @@ -2078,14 +2078,14 @@ def deactivate_motd(click_ctx, motd_id): help="Send MOTD to unit personnel and unit admins only.", ) @click.pass_obj -def send_motd(click_ctx, motd_id, unit_personnel_only): +def send_motd(click_ctx, motd_id, unit_only): """Send motd as email to all users.""" try: with dds_cli.motd_manager.MotdManager( no_prompt=click_ctx.get("NO_PROMPT", False), token_path=click_ctx.get("TOKEN_PATH"), ) as sender: - sender.send_motd(motd_id=motd_id, unit_personnel_only=unit_personnel_only) + sender.send_motd(motd_id=motd_id, unit_only=unit_only) except ( dds_cli.exceptions.AuthenticationError, dds_cli.exceptions.ApiResponseError, diff --git a/dds_cli/motd_manager.py b/dds_cli/motd_manager.py index 4e746179..5cd5a79f 100644 --- a/dds_cli/motd_manager.py +++ b/dds_cli/motd_manager.py @@ -126,13 +126,13 @@ def deactivate_motd(self, motd_id) -> None: ) LOG.info(response_message) - def send_motd(self, motd_id: int, unit_personnel_only=False) -> None: + def send_motd(self, motd_id: int, unit_only=False) -> None: """Send specific MOTD to users.""" response_json, _ = dds_cli.utils.perform_request( endpoint=DDSEndpoint.MOTD_SEND, headers=self.token, method="post", - json={"motd_id": motd_id, "unit_personnel_only": unit_personnel_only}, + json={"motd_id": motd_id, "unit_only": unit_only}, error_message="Failed sending the MOTD to users", ) diff --git a/tests/test_motd_manager.py b/tests/test_motd_manager.py index b3610df3..59b26da5 100644 --- a/tests/test_motd_manager.py +++ b/tests/test_motd_manager.py @@ -242,7 +242,7 @@ def test_send_motd_all(caplog: LogCaptureFixture): with motd_manager.MotdManager(authenticate=False, no_prompt=True) as mtdm: mtdm.token = {} # required, otherwise none - mtdm.send_motd(motd_id=motd_id, unit_personnel_only=False) # Send motd + mtdm.send_motd(motd_id=motd_id, unit_only=False) # Send motd assert ( "dds_cli.motd_manager", From fb158ca71b20bf54c9546a1655f6e7b325d4d8b9 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 17 Oct 2024 16:10:58 +0200 Subject: [PATCH 3/4] prettier --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 62f0d4f7..a49ebbe0 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -387,4 +387,4 @@ _Empty sprint_ # 2024-10-07 - 2024-10-18 -- Update MOTD command according to post merge review ([#720](https://github.com/ScilifelabDataCentre/dds_cli/pull/720)) \ No newline at end of file +- Update MOTD command according to post merge review ([#720](https://github.com/ScilifelabDataCentre/dds_cli/pull/720)) From 7c12a1e977add72d3b2bb48fee92457233510333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:15:53 +0200 Subject: [PATCH 4/4] Update dds_cli/__main__.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- dds_cli/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_cli/__main__.py b/dds_cli/__main__.py index 7d307e8e..6ed3d471 100644 --- a/dds_cli/__main__.py +++ b/dds_cli/__main__.py @@ -2075,7 +2075,7 @@ def deactivate_motd(click_ctx, motd_id): is_flag=True, required=False, default=False, - help="Send MOTD to unit personnel and unit admins only.", + help="Only send MOTD to Unit Admins and Unit Personnel.", ) @click.pass_obj def send_motd(click_ctx, motd_id, unit_only):