dds-cli 2.8.0__tar.gz → 2.8.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dds_cli-2.8.0 → dds_cli-2.8.1}/PKG-INFO +1 -1
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/__main__.py +9 -2
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/motd_manager.py +2 -2
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/version.py +1 -1
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/PKG-INFO +1 -1
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_motd_manager.py +27 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/LICENSE +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/README.md +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/__init__.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/account_manager.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/auth.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/base.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/custom_decorators.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_getter.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_lister.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_putter.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_remover.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/directory.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/exceptions.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_compressor.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_encryptor.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_handler.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_handler_local.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_handler_remote.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/options.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/project_creator.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/project_info.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/project_status.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/s3_connector.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/status.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/superadmin_helper.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/text_handler.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/timestamp.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/unit_manager.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/user.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/utils.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/SOURCES.txt +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/dependency_links.txt +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/entry_points.txt +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/not-zip-safe +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/requires.txt +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/top_level.txt +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/pyproject.toml +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/setup.cfg +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/setup.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/__init__.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_account_manager.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_data_remover.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_file_compressor.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_file_encryptor.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_file_handler_local.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_project_status.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_superadmin_helper.py +0 -0
- {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_utils.py +0 -0
|
@@ -2070,15 +2070,22 @@ def deactivate_motd(click_ctx, motd_id):
|
|
|
2070
2070
|
# -- dds motd send -- #
|
|
2071
2071
|
@motd_group_command.command(name="send")
|
|
2072
2072
|
@click.argument("motd_id", metavar="[MOTD_ID]", nargs=1, type=int, required=True)
|
|
2073
|
+
@click.option(
|
|
2074
|
+
"--unit-only",
|
|
2075
|
+
is_flag=True,
|
|
2076
|
+
required=False,
|
|
2077
|
+
default=False,
|
|
2078
|
+
help="Only send MOTD to Unit Admins and Unit Personnel.",
|
|
2079
|
+
)
|
|
2073
2080
|
@click.pass_obj
|
|
2074
|
-
def send_motd(click_ctx, motd_id):
|
|
2081
|
+
def send_motd(click_ctx, motd_id, unit_only):
|
|
2075
2082
|
"""Send motd as email to all users."""
|
|
2076
2083
|
try:
|
|
2077
2084
|
with dds_cli.motd_manager.MotdManager(
|
|
2078
2085
|
no_prompt=click_ctx.get("NO_PROMPT", False),
|
|
2079
2086
|
token_path=click_ctx.get("TOKEN_PATH"),
|
|
2080
2087
|
) as sender:
|
|
2081
|
-
sender.send_motd(motd_id=motd_id)
|
|
2088
|
+
sender.send_motd(motd_id=motd_id, unit_only=unit_only)
|
|
2082
2089
|
except (
|
|
2083
2090
|
dds_cli.exceptions.AuthenticationError,
|
|
2084
2091
|
dds_cli.exceptions.ApiResponseError,
|
|
@@ -126,13 +126,13 @@ class MotdManager(dds_cli.base.DDSBaseClass):
|
|
|
126
126
|
)
|
|
127
127
|
LOG.info(response_message)
|
|
128
128
|
|
|
129
|
-
def send_motd(self, motd_id: int) -> None:
|
|
129
|
+
def send_motd(self, motd_id: int, unit_only=False) -> None:
|
|
130
130
|
"""Send specific MOTD to users."""
|
|
131
131
|
response_json, _ = dds_cli.utils.perform_request(
|
|
132
132
|
endpoint=DDSEndpoint.MOTD_SEND,
|
|
133
133
|
headers=self.token,
|
|
134
134
|
method="post",
|
|
135
|
-
json={"motd_id": motd_id},
|
|
135
|
+
json={"motd_id": motd_id, "unit_only": unit_only},
|
|
136
136
|
error_message="Failed sending the MOTD to users",
|
|
137
137
|
)
|
|
138
138
|
|
|
@@ -222,3 +222,30 @@ def test_add_new_motd_ok(caplog: LogCaptureFixture):
|
|
|
222
222
|
logging.INFO,
|
|
223
223
|
"Response from API about adding a MOTD.",
|
|
224
224
|
) in caplog.record_tuples
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
# send_motd
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def test_send_motd_all(caplog: LogCaptureFixture):
|
|
231
|
+
"""Send a MOTD to all users."""
|
|
232
|
+
|
|
233
|
+
motd_id = 1
|
|
234
|
+
response_message = "Response from API about sending a MOTD."
|
|
235
|
+
returned_response: Dict = {"message": response_message}
|
|
236
|
+
|
|
237
|
+
with caplog.at_level(logging.INFO):
|
|
238
|
+
# Create mocker
|
|
239
|
+
with Mocker() as mock:
|
|
240
|
+
# Create mocked request - real request not executed
|
|
241
|
+
mock.post(DDSEndpoint.MOTD_SEND, status_code=200, json=returned_response)
|
|
242
|
+
|
|
243
|
+
with motd_manager.MotdManager(authenticate=False, no_prompt=True) as mtdm:
|
|
244
|
+
mtdm.token = {} # required, otherwise none
|
|
245
|
+
mtdm.send_motd(motd_id=motd_id, unit_only=False) # Send motd
|
|
246
|
+
|
|
247
|
+
assert (
|
|
248
|
+
"dds_cli.motd_manager",
|
|
249
|
+
logging.INFO,
|
|
250
|
+
response_message,
|
|
251
|
+
) in caplog.record_tuples
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|